Go lang installation differs?

go version

go version go1.18 gccgo (GCC) 13.2.1 20230801 linux/amd64

gomobile init

gomobile: go install golang.org/x/mobile/cmd/gobind@latest failed: exit status 2
# golang.org/x/tools/internal/event/keys
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:14:10: virhe: expected ”(”
   14 | func Join[S ~[]T, T ~string](s S) string {
      |          ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:14:13: virhe: invalid character 0x7e in input file
   14 | func Join[S ~[]T, T ~string](s S) string {
      |             ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:15:9: virhe: expected ”]”
   15 |         strs := make([]string, 0, len(s))
      |         ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:15:9: virhe: expected ”;” or newline after top level declaration
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:16:9: virhe: expected declaration
   16 |         for _, v := range s {
      |         ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:18:9: virhe: expected declaration
   18 |         }
      |         ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:19:9: virhe: expected declaration
   19 |         sort.Strings(strs)
      |         ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:20:9: virhe: expected declaration
   20 |         return strings.Join(strs, ",")
      |         ^
../../../../pkg/mod/golang.org/x/tools@v0.17.0/internal/event/keys/util.go:21:1: virhe: expected declaration
   21 | }
      | ^

then when I replace gcc-go with ‘go’:

go version

go: downloading go1.23 (linux/amd64)
go: download go1.23 for linux/amd64: toolchain not available

… no toolchain?

go 1.18 has no generics, which used by the package, that you want to install func Join[S ~[]T, T ~string](s S)

go 1.23 does not exist. The actual go version is 1.21. 1.22 is in release candidate stage - All releases - The Go Programming Language

Use 1.21

extra/go 2:1.21.6-1
    Core compiler tools for the Go programming language

P.S. you can install it by the command
sudo pacman -S go

1 Like