weixin_39960920
weixin_39960920
2021-01-09 10:19

Output is not consistent

If I run the same command multiple time on my package github.com/pierrre/imageserver, I get:


➜  imageserver git:(feature/native) gometalinter ./...
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/reader.go:198:10:warning: error return value not checked (defer lzwr.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:258:4:warning: error return value not checked (lzww.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:265:5:warning: error return value not checked (lzww.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:270:2:warning: error return value not checked (lzww.Close()) (errcheck)

➜  imageserver git:(feature/native) gometalinter ./...
examples/advanced/advanced_test.go:14::warning: cyclomatic complexity 15 of function TestServer() is high (> 10) (gocyclo)
graphicsmagick/graphicsmagick.go:152::warning: cyclomatic complexity 19 of function (*Server).buildArgumentsResize() is high (> 10) (gocyclo)
image/nfntresize/nfntresize_test.go:14::warning: cyclomatic complexity 11 of function TestProcessor() is high (> 10) (gocyclo)
graphicsmagick/graphicsmagick.go:83::warning: cyclomatic complexity 12 of function (*Server).process() is high (> 10) (gocyclo)
./image_benchmark_test.go:54::warning: duplicate of ./image_benchmark_test.go:88-104 (dupl)
./image_benchmark_test.go:88::warning: duplicate of ./image_benchmark_test.go:54-70 (dupl)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/jpeg/reader.go:107:6:warning: struct decoder could have size 13288 (currently 13296) (aligncheck)
_test/benchmark.go:22::error: declaration of im shadows declaration at _test/benchmark.go:11: (vetshadow)
nfntresize/validate.go:19::error: declaration of params shadows declaration at nfntresize/validate.go:17: (vetshadow)
validate.go:19::error: declaration of params shadows declaration at validate.go:17: (vetshadow)
cache/_test/benchmark.go:22::error: declaration of im shadows declaration at cache/_test/benchmark.go:11: (vetshadow)
image/nfntresize/validate.go:19::error: declaration of params shadows declaration at image/nfntresize/validate.go:17: (vetshadow)

➜  imageserver git:(feature/native) gometalinter ./...
./image_benchmark_test.go:54::warning: duplicate of ./image_benchmark_test.go:88-104 (dupl)
./image_benchmark_test.go:88::warning: duplicate of ./image_benchmark_test.go:54-70 (dupl)
_test/benchmark.go:22::error: declaration of im shadows declaration at _test/benchmark.go:11: (vetshadow)
validate.go:19::error: declaration of params shadows declaration at validate.go:17: (vetshadow)
nfntresize/validate.go:19::error: declaration of params shadows declaration at nfntresize/validate.go:17: (vetshadow)
cache/_test/benchmark.go:22::error: declaration of im shadows declaration at cache/_test/benchmark.go:11: (vetshadow)
image/nfntresize/validate.go:19::error: declaration of params shadows declaration at image/nfntresize/validate.go:17: (vetshadow)

➜  imageserver git:(feature/native) gometalinter ./...
cache/cache.go:31:2:warning: error return value not checked (c.Cache.Set(key, image, params)) (errcheck)
cache/cache.go:45:3:warning: error return value not checked (a.Cache.Set(key, image, params)) (errcheck)
cache/server.go:75:3:warning: error return value not checked (io.WriteString(h, params.String())) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:144:2:warning: error return value not checked (d.crc.Write(d.tmp[:13])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:229:2:warning: error return value not checked (d.crc.Write(d.tmp[:n])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:262:2:warning: error return value not checked (d.crc.Write(d.tmp[:n])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:308:3:warning: error return value not checked (d.crc.Write(d.tmp[4:8])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:314:2:warning: error return value not checked (d.crc.Write(p[:n])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:325:8:warning: error return value not checked (defer r.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:695:2:warning: error return value not checked (d.crc.Write(d.tmp[4:8])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/reader.go:737:3:warning: error return value not checked (d.crc.Write(ignored[:n])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/writer.go:97:2:warning: error return value not checked (crc.Write(e.header[4:8])) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/writer.go:98:2:warning: error return value not checked (crc.Write(b)) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/png/writer.go:281:8:warning: error return value not checked (defer zw.Close()) (errcheck)
httpsource/httpsource.go:35:8:warning: error return value not checked (defer response.Body.Close()) (errcheck)
params.go:134:2:warning: error return value not checked (buf.WriteString("map[")) (errcheck)
params.go:137:4:warning: error return value not checked (buf.WriteString(" ")) (errcheck)
params.go:139:3:warning: error return value not checked (buf.WriteString(key)) (errcheck)
params.go:140:3:warning: error return value not checked (buf.WriteString(":")) (errcheck)
params.go:141:3:warning: error return value not checked (buf.WriteString(fmt.Sprint(params[key]))) (errcheck)
params.go:143:2:warning: error return value not checked (buf.WriteString("]")) (errcheck)
graphicsmagick/graphicsmagick.go:121:8:warning: error return value not checked (defer os.RemoveAll(tempDir)) (errcheck)
graphicsmagick/graphicsmagick.go:341:3:warning: error return value not checked (cmd.Process.Kill()) (errcheck)
http/handler.go:141:3:warning: error return value not checked (io.WriteString(h, params.String())) (errcheck)
cache/redis/redis.go:39:8:warning: error return value not checked (defer conn.Close()) (errcheck)
cache/redis/redis.go:65:8:warning: error return value not checked (defer conn.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/reader.go:198:10:warning: error return value not checked (defer lzwr.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:258:4:warning: error return value not checked (lzww.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:265:5:warning: error return value not checked (lzww.Close()) (errcheck)
/home/pierre/.gimme/versions/go1.5.1.src/src/image/gif/writer.go:270:2:warning: error return value not checked (lzww.Close()) (errcheck)
graphicsmagick/graphicsmagick.go:152::warning: cyclomatic complexity 19 of function (*Server).buildArgumentsResize() is high (> 10) (gocyclo)
graphicsmagick/graphicsmagick.go:83::warning: cyclomatic complexity 12 of function (*Server).process() is high (> 10) (gocyclo)
./image_benchmark_test.go:54::warning: duplicate of ./image_benchmark_test.go:88-104 (dupl)
./image_benchmark_test.go:88::warning: duplicate of ./image_benchmark_test.go:54-70 (dupl)
image/nfntresize/nfntresize_test.go:14::warning: cyclomatic complexity 11 of function TestProcessor() is high (> 10) (gocyclo)
examples/advanced/advanced_test.go:14::warning: cyclomatic complexity 15 of function TestServer() is high (> 10) (gocyclo)

该提问来源于开源项目:alecthomas/gometalinter

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

7条回答

为你推荐

换一换