hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.78k stars 651 forks source link

examples: remove `example` build tags when we can drop Go 1.16 #1462

Closed hajimehoshi closed 1 year ago

hajimehoshi commented 3 years ago

The examples build tag is to prevent users from install example binaries unexpectedly. However, as installing with a version will be must outside a module, and ... like go install foo/bar/... will no longer be recommended (not sure, let me double-check), we might not need the tag any more.

https://tip.golang.org/doc/go1.16#go-command

Module-aware mode is enabled by default, regardless of whether a go.mod file is present in the current working directory or a parent directory. More precisely, the GO111MODULE environment variable now defaults to on. To switch to the previous behavior, set GO111MODULE to auto.

[...]

go install now accepts arguments with version suffixes (for example, go install example.com/cmd@v1.0.0). This causes go install to build and install packages in module-aware mode, ignoring the go.mod file in the current directory or any parent directory, if there is one. This is useful for installing executables without affecting the dependencies of the main module.

go install, with or without a version suffix (as described above), is now the recommended way to build and install packages in module mode. go get should be used with the -d flag to adjust the current module's dependencies without building packages, and use of go get to build and install packages is deprecated. In a future release, the -d flag will always be enabled.

nullptr023 commented 3 years ago

Hi, just started trying out ebiten for first time and it looks like the 'examples' build tag is removed? Is that correct? I tried the following command: go version go version go1.15.6 linux/amd64

go run -tags=example github.com/hajimehoshi/ebiten/v2/examples/rotate cannot find package "github.com/hajimehoshi/ebiten/v2/examples/rotate" in any of: /usr/lib64/golang/src/github.com/hajimehoshi/ebiten/v2/examples/rotate (from $GOROOT) /home/avillanueva/Development/go/src/github.com/hajimehoshi/ebiten/v2/examples/rotate (from $GOPATH)

If the tag is removed, what's the method to install the Ebiten? Thank you.

hajimehoshi commented 3 years ago

Hi, just started trying out ebiten for first time and it looks like the 'examples' build tag is removed?

Not yet.

hajimehoshi commented 3 years ago

If the tag is removed, what's the method to install the Ebiten?

You mean the examples? Just -tags=example will be no longer required.

nullptr023 commented 3 years ago

yeah .so I just need to do 'go get github.com/hajimehoshi/ebiten ? '

hajimehoshi commented 3 years ago

You don't need to do go get as long as you use Go modules. go run or go build already automatically download necessary files.

hajimehoshi commented 3 years ago

Hm, go get still installs binaries with Go 1.17. I'll postpone this to Go 1.19.

hajimehoshi commented 2 years ago

go get with the module mode no longer installs binaries as of Go 1.18

go get no longer builds or installs packages in module-aware mode. go get is now dedicated to adjusting dependencies in go.mod.

Then, let's keep the build tag until the next Debian stable version is released and we can give up supporting Go 1.15-1.17 :-) So probably these things happen in 2023 winter, Ebitengine v2.7?