semantics need to be given some consideration.
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface.go
File src/pkg/net/interface.go (right):
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface.go#newcode26
src/pkg/net/interface.go:26: )
suggestion (feel free to ignore it)
var interfaceCache = struct {
sync.Mutex
indexMap map[...]...
nameMap map[...]...
}{ indexMap: make(...), nameMap: make(...) }
then (i think) it is clearer in the code (see below)
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface.go#newcode29
src/pkg/net/interface.go:29: interfaceMapLock.RLock()
interfaceCache.Lock()
defer ...
ifi, ok := interfaceCache.indexMap[index]
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface.go#newcode110
src/pkg/net/interface.go:110: // Interfaces returns a list of the
system's network interfaces. It
On 2013/02/21 17:16:46, bradfitz wrote:
drop this doc addition. it's an internal detail. callers don't care
or need to
know.
+1. One day we might not want to use a cache.drop this doc addition. it's an internal detail. callers don't care
or need to
know.
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface.go#newcode113
src/pkg/net/interface.go:113: func Interfaces() ([]Interface, error) {
Why does this function always overwrite the cache when called?
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface_test.go
File src/pkg/net/interface_test.go (right):
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface_test.go#newcode16
src/pkg/net/interface_test.go:16: if err != nil {
should this take a *testing.T), then you can t.Fatal(err) ?
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/interface_test.go#newcode132
src/pkg/net/interface_test.go:132: b.Fatalf("loopback interface not
found")
Is b.Skip() of use now ?
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/ipsock.go
File src/pkg/net/ipsock.go (right):
https://codereview.appspot.com/7384048/diff/11001/src/pkg/net/ipsock.go#newcode16
src/pkg/net/ipsock.go:16: Interfaces()
please add a comment
// populate interface cache
https://codereview.appspot.com/7384048/
--
---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.