Friday, June 20, 2025
HomeGolangMaking an attempt to obtain golang.org/x/exp/constraints - Getting Assist

Making an attempt to obtain golang.org/x/exp/constraints – Getting Assist


Pretty new to utilizing go modules. I’m working by a category and they’re speaking about package deal constraints. I discovered the code and the legitimate go.mod file

module golang.org/x/exp

go 1.23.0

require (
	github.com/google/go-cmp v0.6.0
	golang.org/x/mod v0.24.0
	golang.org/x/instruments v0.33.0
)

require golang.org/x/sync v0.14.0 // oblique

And I can do go mod obtain for for the required packages however when I attempt to execute:

go get golang.org/x/exp/contstraints

which ought to work however I get an error:

go: golang.org/x/exp/contstraints: no matching variations for question "improve"

I additionally tried downloading completely different commits:

go get golang.org/x/exp/contstraints@2b6e20a6d8b6a7fa47ce7f245c422b7abb361048

however I get quite a lot of completely different errors from:

golang.org/x/exp/contstraints@v0.0.0-20250506013429-2b6e20a6d8b6: invalid model: lacking golang.org/x/exp/contstraints/go.mod at revision 2b6e20a6d8b6

to

go: module golang.org/x/exp@2b6e20a6d8b6a7fa47ce7f245c422b7abb361048 discovered (v0.0.0-20250506013429-2b6e20a6d8b6), however doesn't include package deal golang.org/x/exp/contstraints

I understand that is experimental code and doesn’t have any compatibility assure I’m extra curious if I’m doing one thing improper and whether or not or not I ought to be capable to do that. I’m operating go 1.24.2:

dan@workstation-DBDGVD3:~/Class/002-Learning_Go-Take2/023-Generics/186-Package_constraints$ go env
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/residence/dan/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/residence/dan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/residence/dan/tmp/go-build3918362781=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/residence/dan/Class/002-Learning_Go-Take2/023-Generics/186-Package_constraints/go.mod'
GOMODCACHE='/residence/dan/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/residence/dan/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTELEMETRY='native'

Thanks prematurely,

Dan

go get golang.org/x/exp/contstraints

Assuming that you just’re after golang.org/x/exp/constraints, you’ve obtained an additional ‘t’ in there. I believe that you just most likely meant to do that.

go get golang.org/x/exp/constraints

Yeah it was only a mistype, however I nonetheless get

go: golang.org/x/exp/constraints: no matching variations for question "improve"

or once I add the tag I get:

go: golang.org/x/constraints@newest: unrecognized import path "golang.org/x/constraints": studying https://golang.org/x/constraints?go-get=1: 404 Not Discovered
        server response: 404 web page not discovered

though I’m wanting proper on the information.

I even tried the model strategy and get the identical reply

dan@workstation-DBDGVD3:~/Class/002-Learning_Go-Take2/023-Generics/186-Package_constraints$ go get golang.org/x/constraints@v0.0.0-20250506013437-ce4c2cf36ca6
go: golang.org/x/constraints@v0.0.0-20250506013437-ce4c2cf36ca6: unrecognized import path "golang.org/x/constraints": studying https://golang.org/x/constraints?go-get=1: 404 Not Discovered
        server response: 404 web page not discovered

though once more I’m wanting proper on the information, :grinning_face_with_smiling_eyes:

Are you positive that’s not one other typo? You seem to have dropped the exp a part of the module path.

Including again exp works effective for me.

$ mkdir constraints-question
$ cd constraints-question
$ go mod init constraints-question
go: creating new go.mod: module constraints-question
$ go get golang.org/x/exp/constraints@v0.0.0-20250506013437-ce4c2cf36ca6
go: added golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6
$ cat go.mod
module constraints-question

go 1.24.0

require golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // oblique
$

And with out an specific model.

$ mkdir constraints-question
$ cd constraints-question
$ go mod init constraints-question
go: creating new go.mod: module constraints-question
$ go get golang.org/x/exp/constraints
go: added golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6
$ cat go.mod
module constraints-question

go 1.24.0

require golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // oblique
$

You’ve not obtained any configuration that may be related to getting modules, corresponding to GOPROXY, GOPRIVATE, or GONOPROXY surroundings variables?

That did the trick, thanks a lot, @pekim ++

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments