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
cd<path_to_cloned_mainflux_repo>/cmd/users
go build .
main.go:35:2: //go:build comment without // +build comment
What are the steps to reproduce the issue?
clone the repo
try do build Mainflux or one of its services with go version earlier that v17.0.0
In what environment did you encounter the issue?
go version
go version go1.16.15 linux/amd64
I've encountered this issue with go 1.16.15, but I wanted to see with which go version does the problem starts. I found out that the problem appears with go v1.16 and disappears with go v17.0.
Additional information you deem important:
I've checked what the Go design proposals and I've found this draft proposal. In this document it is specified that the new notation is as we have it in the master at the moment //go:build <comment>, //go:build !test. It is also specified that as a transition that:
Go 1.(N−1) would prepare for the transition with minimal changes. In Go 1.(N−1):
- Builds will fail when a Go source file contains //go:build lines without // +build lines.
This is why I could not build with go v1.16.15. The fix to support go v16.x in our case is to simply add another // +build !test line right after each // go:build !test line. If we add the // +build !test line it will be used as fallback for the older versions. The changes of the go build tag were introduced in the code with the MF-1308 PR.
The fix would be to add the following pair wherever we have the build tag:
//go:build !test//+build !test
I've done test adding the lines above in few files and I could build successfully with go v16.x.
@mainflux/contributors What do you think? Should I create a PR with a fix?
The text was updated successfully, but these errors were encountered:
I think that simply setting the minimum Go version to 1.17, which implicitly solves this problem, is perfectly fine. In go.mod file we also use 1.17, and I've been even using go mod tidy -compat=1.17 command when updating dependencies. This will solve both #1578 and #1577. I see no real benefits of keeping compatibility with Go 1.16 or below.
@dusanb94 I agree completely with you. I was thinking to fix this for go v16.x as there is is the stable bugfix release for the latest and latest - 1 release version for the go language itself. If we say we always need the latest stable version its also good, but we need to adjust the docs accordingly.
BUG REPORT
What were you trying to achieve?
Build mainflux with
make build
or separate microservices withgo build .
.What are the expected results?
The build process finishes successfully.
What are the received results?
I've encountered this issue with
go 1.16.15
, but I wanted to see with which go version does the problem starts. I found out that the problem appears withgo v1.16
and disappears withgo v17.0
.I've checked what the Go design proposals and I've found this draft proposal. In this document it is specified that the new notation is as we have it in the master at the moment
//go:build <comment>
,//go:build !test
. It is also specified that as a transition that:This is why I could not build with
go v1.16.15
. The fix to supportgo v16.x
in our case is to simply add another// +build !test
line right after each// go:build !test
line. If we add the// +build !test
line it will be used as fallback for the older versions. The changes of the go build tag were introduced in the code with the MF-1308 PR.The fix would be to add the following pair wherever we have the build tag:
I've done test adding the lines above in few files and I could build successfully with
go v16.x
.@mainflux/contributors What do you think? Should I create a PR with a fix?
The text was updated successfully, but these errors were encountered: