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
I wanted to use embedded SQL migration files in a Go 1.17 project and this required to use the github.com/golang-migrate/migrate/v4/source/iofs migration source driver. The source/iofs driver was added to golang-migrate/migrate shortly after Go 1.16 with embed.FS was released. In order to be compatible with Go versions prior 1.16 a build tag was added such that source/iofs can only be used with Go 1.16 and newer. The documentation about build constraints states:
a term for each Go major release, through the current version:
"go1.1" from Go version 1.1 onward, "go1.12" from Go 1.12, and so on.
If this holds then the package must be importable in Go 1.17 projects as well, but it isn't. A minimal example that demonstrates this issue can be found in this playground. Here is the example's source code:
Interestingly, the package can be imported when go1.17 was added to the build tags as well. I did this in golang-migrate/migrate#618 .
What did you expect to see?
That github.com/golang-migrate/migrate/v4/source/iofs can be imported in a Go 1.17 project since the build tag //go:build go1.16 allows all Go version starting from 1.16.
What did you see instead?
That go get refuses to add the import:
$ go get .
cmd/inject/inject.go:30:2: no required module provides package github.com/golang-migrate/migrate/v4/source/iofs; to add it:
go get github.com/golang-migrate/migrate/v4/source/iofs
The text was updated successfully, but these errors were encountered:
I don't think this is related to build constraints.
It looks like this package was deleted between v4.14.0 and v4.14.1 (the current latest version), then the deletion was reverted some time later (but not in a release version). One of these commands should work:
go get github.com/golang-migrate/migrate/v4@v4.14.0
go get github.com/golang-migrate/migrate/v4@v4.15.0-beta.3
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, even with the latest
gotip
version.$ gotip version go version devel go1.18-4847c47 Wed Sep 15 03:29:46 2021 +0000 linux/amd64 $ gotip get . example imports github.com/golang-migrate/migrate/v4/source/iofs: cannot find module providing package github.com/golang-migrate/migrate/v4/source/iofs
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wanted to use embedded SQL migration files in a Go 1.17 project and this required to use the
github.com/golang-migrate/migrate/v4/source/iofs
migration source driver. Thesource/iofs
driver was added togolang-migrate/migrate
shortly after Go 1.16 withembed.FS
was released. In order to be compatible with Go versions prior 1.16 a build tag was added such thatsource/iofs
can only be used with Go 1.16 and newer. The documentation about build constraints states:If this holds then the package must be importable in Go 1.17 projects as well, but it isn't. A minimal example that demonstrates this issue can be found in this playground. Here is the example's source code:
Interestingly, the package can be imported when
go1.17
was added to the build tags as well. I did this in golang-migrate/migrate#618 .What did you expect to see?
That
github.com/golang-migrate/migrate/v4/source/iofs
can be imported in a Go 1.17 project since the build tag//go:build go1.16
allows all Go version starting from 1.16.What did you see instead?
That
go get
refuses to add the import:The text was updated successfully, but these errors were encountered: