summaryrefslogtreecommitdiffhomepage
path: root/runsc/fsgofer
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-07-12 16:43:01 -0700
committergVisor bot <gvisor-bot@google.com>2021-07-12 16:45:33 -0700
commit7132b9a07b55b1c2944f19bb938878d147785a72 (patch)
treec3d26f612b2b02d6c631a746e619c07235ffa556 /runsc/fsgofer
parente3fdd1593217894328d5a917bbc356d0a7d145f0 (diff)
Fix GoLand analyzer errors under runsc/...
PiperOrigin-RevId: 384344990
Diffstat (limited to 'runsc/fsgofer')
-rw-r--r--runsc/fsgofer/fsgofer.go8
-rw-r--r--runsc/fsgofer/fsgofer_test.go17
2 files changed, 8 insertions, 17 deletions
diff --git a/runsc/fsgofer/fsgofer.go b/runsc/fsgofer/fsgofer.go
index 3f362b25e..07497e47b 100644
--- a/runsc/fsgofer/fsgofer.go
+++ b/runsc/fsgofer/fsgofer.go
@@ -51,10 +51,10 @@ const (
// verityXattrs are the extended attributes used by verity file system.
var verityXattrs = map[string]struct{}{
- "user.merkle.offset": struct{}{},
- "user.merkle.size": struct{}{},
- "user.merkle.childrenOffset": struct{}{},
- "user.merkle.childrenSize": struct{}{},
+ "user.merkle.offset": {},
+ "user.merkle.size": {},
+ "user.merkle.childrenOffset": {},
+ "user.merkle.childrenSize": {},
}
// join is equivalent to path.Join() but skips path.Clean() which is expensive.
diff --git a/runsc/fsgofer/fsgofer_test.go b/runsc/fsgofer/fsgofer_test.go
index 77723827a..ee6cc97df 100644
--- a/runsc/fsgofer/fsgofer_test.go
+++ b/runsc/fsgofer/fsgofer_test.go
@@ -65,15 +65,6 @@ func configTestName(conf *Config) string {
return "RWMount"
}
-func assertPanic(t *testing.T, f func()) {
- defer func() {
- if r := recover(); r == nil {
- t.Errorf("function did not panic")
- }
- }()
- f()
-}
-
func testReadWrite(f p9.File, flags p9.OpenFlags, content []byte) error {
want := make([]byte, len(content))
copy(want, content)
@@ -195,7 +186,7 @@ func setup(fileType uint32) (string, string, error) {
}
root, err := a.Attach()
if err != nil {
- return "", "", fmt.Errorf("Attach failed, err: %v", err)
+ return "", "", fmt.Errorf("attach failed, err: %v", err)
}
defer root.Close()
@@ -290,10 +281,10 @@ func checkIDs(f p9.File, uid, gid int) error {
return fmt.Errorf("GetAttr() failed, err: %v", err)
}
if want := p9.UID(uid); stat.UID != want {
- return fmt.Errorf("Wrong UID, want: %v, got: %v", want, stat.UID)
+ return fmt.Errorf("wrong UID, want: %v, got: %v", want, stat.UID)
}
if want := p9.GID(gid); stat.GID != want {
- return fmt.Errorf("Wrong GID, want: %v, got: %v", want, stat.GID)
+ return fmt.Errorf("wrong GID, want: %v, got: %v", want, stat.GID)
}
return nil
}
@@ -574,7 +565,7 @@ func SetGetXattr(l *localFile, name string, value string) error {
return err
}
if ret != value {
- return fmt.Errorf("Got value %s, want %s", ret, value)
+ return fmt.Errorf("got value %s, want %s", ret, value)
}
return nil
}