You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
philipp@philipp-XPS-15-9500:~/src/fastly/go-fastly$ GO=go1.20.14 make staticcheck
==> Running staticcheck
staticcheck 2023.1.7 (v0.4.7)
/usr/local/go/src/crypto/subtle/xor.go:12:7: undefined: min (compile)
/usr/local/go/src/runtime/mfixalloc.go:60:9: undefined: max (compile)
/usr/local/go/src/runtime/mgcmark.go:1427:7: undefined: min (compile)
/usr/local/go/src/runtime/mgcpacer.go:1146:15: undefined: max (compile)
/usr/local/go/src/runtime/mgcpacer.go:1156:12: undefined: max (compile)
/usr/local/go/src/runtime/mgcpacer.go:1157:12: undefined: min (compile)
/usr/local/go/src/runtime/mgcscavenge.go:954:10: undefined: min (compile)
/usr/local/go/src/runtime/mpagealloc.go:1059:10: undefined: max (compile)
/usr/local/go/src/runtime/mpallocbits.go:150:10: undefined: max (compile)
/usr/local/go/src/runtime/mpallocbits.go:159:9: undefined: max (compile)
/usr/local/go/src/runtime/runtime1.go:439:25: undefined: min (compile)
/usr/local/go/src/runtime/symtab.go:1174:10: undefined: max (compile)
/usr/local/go/src/runtime/time.go:189:17: cannot range over 3 (untyped int constant) (compile)
/usr/local/go/src/runtime/time.go:1190:11: undefined: min (compile)
/usr/local/go/src/runtime/time.go:1256:37: undefined: min (compile)
make: *** [Makefile:73: staticcheck] Error 1
Thank you for raising this bug! I have a quick question: why is staticcheck ./... attempting to analyze the Go standard library source code (e.g., /usr/local/go/src/...)? This behavior isn’t normal and likely points to an environment issue.
Typically, staticcheck ./... should only analyze the project’s code. However, in this case, it seems to be analyzing the Go standard library, which could potentially be caused by the GO variable interfering with how staticcheck resolves package paths.
To investigate, I tried running it inside a Docker container since I am using a Mac, but I wasn’t able to reproduce the issue:
# GO=go1.20.14 make staticcheck
==> Running staticcheck
staticcheck 2023.1.7 (v0.4.7)
Potential Solution
@kpfleming , would it make sense to update the Makefile to explicitly list only project packages? For example:
staticcheck
fails locally maybe releated to #580:but passes in CI (https://github.com/fastly/go-fastly/actions/runs/12993241925/job/36234990394):
The text was updated successfully, but these errors were encountered: