Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile build recipe for oldstable image fails to build with pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment #588

Closed
atc0005 opened this issue Mar 30, 2022 · 2 comments · Fixed by #589
Assignees
Labels
bug Something isn't working oldstable
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Mar 30, 2022

Building oldstable release
sudo docker image build \
	--pull \
	--no-cache \
	oldstable/ \
	-t  registry-1.docker.io/atc0005/go-ci:go-ci-oldstable \
	-t  registry-1.docker.io/atc0005/go-ci:go-ci-oldstable-v0.6.5-8-ga4f7f6d \
	-t  ghcr.io/atc0005/go-ci:go-ci-oldstable \
	-t  ghcr.io/atc0005/go-ci:go-ci-oldstable-v0.6.5-8-ga4f7f6d \
	--label=atc0005.go-ci \
	--label=org.opencontainers.image.revision="a4f7f6dd94febd823ac89b9189003f09bbfbeaeb" \
	--label=org.opencontainers.image.created="2022-03-30 09:49:55+00:00"
Sending build context to Docker daemon  8.192kB
Step 1/21 : FROM golang:1.16.15
1.16.15: Pulling from library/golang
e4d61adff207: Pull complete 
4ff1945c672b: Pull complete 
ff5b10aec998: Pull complete 
12de8c754e45: Pull complete 
8c86ff77a317: Pull complete 
0395a1c478ba: Pull complete 
245345d44ed8: Pull complete 
Digest: sha256:5f6a4662de3efc6d6bb812d02e9de3d8698eea16b8eb7281f03e6f3e8383018e
Status: Downloaded newer image for golang:1.16.15
 ---> 972d8c0bc0fc
Step 2/21 : LABEL org.opencontainers.image.source="https://github.com/atc0005/go-ci"
 ---> Running in 62ed9fbda30f
Removing intermediate container 62ed9fbda30f
 ---> 1d1c11a3f49a
Step 3/21 : LABEL org.opencontainers.image.documentation="https://github.com/atc0005/go-ci"
 ---> Running in 2088a641d3dc
Removing intermediate container 2088a641d3dc
 ---> a1869287a32b
Step 4/21 : LABEL org.opencontainers.image.url="https://github.com/atc0005/go-ci"
 ---> Running in f6e911929f92
Removing intermediate container f6e911929f92
 ---> 34176be102ad
Step 5/21 : LABEL org.opencontainers.image.title="go-ci-oldstable"
 ---> Running in 37a550565b5a
Removing intermediate container 37a550565b5a
 ---> 17b2112d3a5f
Step 6/21 : LABEL org.opencontainers.image.description="Docker container image used to lint, build and test Go code.     Based on the latest version of the current outgoing stable golang image."
 ---> Running in b4e50ec61af7
Removing intermediate container b4e50ec61af7
 ---> e079c02dd457
Step 7/21 : LABEL org.opencontainers.image.authors="Adam Chalkley (github.com/atc0005)"
 ---> Running in 13453afcd027
Removing intermediate container 13453afcd027
 ---> 8d4a3c210668
Step 8/21 : ENV GOLANGCI_LINT_VERSION="v1.45.2"
 ---> Running in 8fd0538befd7
Removing intermediate container 8fd0538befd7
 ---> 34b9361824e2
Step 9/21 : ENV STATICCHECK_VERSION="v0.3.0"
 ---> Running in ab2f0ce22377
Removing intermediate container ab2f0ce22377
 ---> bf59e2ef4e20
Step 10/21 : ENV HTTPERRORYZER_VERSION="v0.0.1"
 ---> Running in 6ec873529555
Removing intermediate container 6ec873529555
 ---> 93f767abc497
Step 11/21 : ENV STRUCTSLOP_VERSION="v0.0.6"
 ---> Running in 8fdcb70e4d72
Removing intermediate container 8fdcb70e4d72
 ---> 0f9d5f819c6c
Step 12/21 : ENV TOMLL_VERSION="v1.9.4"
 ---> Running in 3e079713f6f2
Removing intermediate container 3e079713f6f2
 ---> dc3b3f503acd
Step 13/21 : ENV ERRWRAP_VERSION="v1.4.0"
 ---> Running in 200fadad06d6
Removing intermediate container 200fadad06d6
 ---> 01849419dccc
Step 14/21 : ENV APT_BSDMAINUTILS_VERSION="12.1.7+nmu3"
 ---> Running in 39c0df7cf8f4
Removing intermediate container 39c0df7cf8f4
 ---> 736aeef7bfb0
Step 15/21 : ENV APT_TREE_VERSION="1.8.0-1+b1"
 ---> Running in 853998c5c2ce
Removing intermediate container 853998c5c2ce
 ---> e9f6e291b171
Step 16/21 : RUN apt-get update     && apt-get install -y --no-install-recommends     bsdmainutils=${APT_BSDMAINUTILS_VERSION}     tree=${APT_TREE_VERSION}     && apt-get clean     && rm -rf /var/lib/apt/lists/*         && go install honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}     && staticcheck --version     && curl -sSfLO https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh     && sh install.sh -b "$(go env GOPATH)/bin" ${GOLANGCI_LINT_VERSION}     && golangci-lint --version     && go install github.com/orijtech/httperroryzer/cmd/httperroryzer@${HTTPERRORYZER_VERSION}     && go install github.com/orijtech/structslop/cmd/structslop@${STRUCTSLOP_VERSION}     && go install github.com/pelletier/go-toml/cmd/tomll@${TOMLL_VERSION}     && go install github.com/fatih/errwrap@${ERRWRAP_VERSION}     && go clean -cache -modcache
 ---> Running in e3891cf29981
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [123 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
Fetched 8507 kB in 2s (3631 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  bsdextrautils ncal
Suggested packages:
  calendar whois vacation mailutils
The following NEW packages will be installed:
  bsdextrautils bsdmainutils ncal tree
0 upgraded, 4 newly installed, 0 to remove and 24 not upgraded.
Need to get 242 kB of archives.
After this operation, 608 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 bsdextrautils amd64 2.36.1-8+deb11u1 [145 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 ncal amd64 12.1.7+nmu3 [30.1 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 bsdmainutils all 12.1.7+nmu3 [16.4 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 tree amd64 1.8.0-1+b1 [49.6 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 242 kB in 1s (404 kB/s)
Selecting previously unselected package bsdextrautils.
(Reading database ... 15709 files and directories currently installed.)
Preparing to unpack .../bsdextrautils_2.36.1-8+deb11u1_amd64.deb ...
Unpacking bsdextrautils (2.36.1-8+deb11u1) ...
Selecting previously unselected package ncal.
Preparing to unpack .../ncal_12.1.7+nmu3_amd64.deb ...
Unpacking ncal (12.1.7+nmu3) ...
Selecting previously unselected package bsdmainutils.
Preparing to unpack .../bsdmainutils_12.1.7+nmu3_all.deb ...
Unpacking bsdmainutils (12.1.7+nmu3) ...
Selecting previously unselected package tree.
Preparing to unpack .../tree_1.8.0-1+b1_amd64.deb ...
Unpacking tree (1.8.0-1+b1) ...
Setting up bsdextrautils (2.36.1-8+deb11u1) ...
update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode
Setting up ncal (12.1.7+nmu3) ...
Setting up bsdmainutils (12.1.7+nmu3) ...
Setting up tree (1.8.0-1+b1) ...
go: downloading honnef.co/go/tools v0.3.0
go: downloading golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a
go: downloading golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e
go: downloading github.com/BurntSushi/toml v0.4.1
go: downloading golang.org/x/sys v0.0.0-20211019181941-9d821ace8654
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment
The command '/bin/sh -c apt-get update     && apt-get install -y --no-install-recommends     bsdmainutils=${APT_BSDMAINUTILS_VERSION}     tree=${APT_TREE_VERSION}     && apt-get clean     && rm -rf /var/lib/apt/lists/*         && go install honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}     && staticcheck --version     && curl -sSfLO https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh     && sh install.sh -b "$(go env GOPATH)/bin" ${GOLANGCI_LINT_VERSION}     && golangci-lint --version     && go install github.com/orijtech/httperroryzer/cmd/httperroryzer@${HTTPERRORYZER_VERSION}     && go install github.com/orijtech/structslop/cmd/structslop@${STRUCTSLOP_VERSION}     && go install github.com/pelletier/go-toml/cmd/tomll@${TOMLL_VERSION}     && go install github.com/fatih/errwrap@${ERRWRAP_VERSION}     && go clean -cache -modcache' returned a non-zero code: 1
Makefile:106: recipe for target 'build' failed
make: *** [build] Error 1
@atc0005 atc0005 added bug Something isn't working oldstable labels Mar 30, 2022
@atc0005 atc0005 added this to the v0.6.6 milestone Mar 30, 2022
@atc0005 atc0005 self-assigned this Mar 30, 2022
@atc0005
Copy link
Owner Author

atc0005 commented Mar 30, 2022

Official documentation has this to say:

Beginning with Go 1.17, the simplest way of installing Staticcheck is by running go install honnef.co/go/tools/cmd/staticcheck@latest. This will install the latest version of Staticcheck to $GOPATH/bin. To find out where $GOPATH is, run go env GOPATH. Instead of @latest, you can also use a specific version, such as @2020.2.1

While the installation process seems to have worked fine with Go 1.16, it evidently no longer does. I guess we'll need to install the precompiled binary from the GitHub releases section instead.

@atc0005
Copy link
Owner Author

atc0005 commented Mar 30, 2022

Attempting go get works just as well (it doesn't):

$ docker container run --rm -it golang:1.16.15
root@a50762e5a6a0:/go# go get honnef.co/go/tools/cmd/staticcheck@v0.3.0                
go: downloading honnef.co/go/tools v0.3.0
go: downloading golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a
go: downloading golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e
go: downloading golang.org/x/sys v0.0.0-20211019181941-9d821ace8654
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/BurntSushi/toml v0.4.1
go: downloading golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
pkg/mod/honnef.co/go/tools@v0.3.0/go/ir/builder.go:36:2: //go:build comment without // +build comment

Checking the official repo, I found this (dominikh/go-tools#1237 (comment)):

go/ir/builder.go:36:2: //go:build comment without // +build comment (compile)

That's from Go itself, and irrelevant, since only versions up to 1.16 will complain about that, and we only support the last two versions, currently 1.17 and 1.18.

This suggests that even if we use the precompiled binary for the Go 1.16 based oldstable image we're likely to encounter issues. Probably best to roll back to v0.2.2 for now.

atc0005 added a commit that referenced this issue Mar 30, 2022
v0.3.0 is incompatible with Go 1.16, so we will need to freeze
the staticheck release at v0.2.2 for now. Once we update the
oldstable image to Go 1.17 we can then use the latest
staticcheck version again.

refs GH-588
atc0005 added a commit that referenced this issue Mar 30, 2022
Emit intent to install a speciifc tool and version prior to
doing so. This can help identify an installation failure
when future incompatibilities arise.

refs GH-588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working oldstable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant