From c5434e293d10b2a0f04e45dbcf5cf8898db6aef1 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 18 Aug 2013 11:31:56 -0700 Subject: [PATCH] netutil: for better backtraces use named function. Per feedback on https://camlistore-review.googlesource.com/507 Change-Id: Id6c0e4f66d221e6677167aaf590dc3cc696e5391 --- pkg/netutil/ident.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/netutil/ident.go b/pkg/netutil/ident.go index 04223ba8c..f55fffeba 100644 --- a/pkg/netutil/ident.go +++ b/pkg/netutil/ident.go @@ -128,8 +128,10 @@ func (p maybeBrackets) String() string { return s } -// Store in a var so we can override for testing. -var uidFromUsername = func(username string) (uid int, err error) { +// Changed by tests. +var uidFromUsername = uidFromUsernameFn + +func uidFromUsernameFn(username string) (uid int, err error) { if uid := os.Getuid(); uid != 0 && username == os.Getenv("USER") { return uid, nil }