golang-migrate/migrate · error

not yet implemented

Error message

not yet implemented

What it means

The go-bindata source driver's Open method is a stub that unconditionally returns 'not yet implemented'. The driver only supports instantiation via WithInstance with an *AssetSource, so constructing it from a URL string is not supported at all in this version of the library.

Source

Thrown at source/go_bindata/go-bindata.go:37

}

type AssetSource struct {
	Names     []string
	AssetFunc AssetFunc
}

func init() {
	source.Register("go-bindata", &Bindata{})
}

type Bindata struct {
	path        string
	assetSource *AssetSource
	migrations  *source.Migrations
}

func (b *Bindata) Open(url string) (source.Driver, error) {
	return nil, fmt.Errorf("not yet implemented")
}

var (
	ErrNoAssetSource = fmt.Errorf("expects *AssetSource")
)

func WithInstance(instance interface{}) (source.Driver, error) {
	if _, ok := instance.(*AssetSource); !ok {
		return nil, ErrNoAssetSource
	}
	as := instance.(*AssetSource)

	bn := &Bindata{
		path:        "<go-bindata>",
		assetSource: as,
		migrations:  source.NewMigrations(),
	}

View on GitHub (pinned to 01a9643f14)

Solutions

  1. Use WithInstance(&AssetSource{...}) to construct the driver instead of Open
  2. Register the driver instance with migrate.NewWithInstance("bindata", driver) rather than using a bindata:// URL
  3. If URL-based opening is required, check whether a newer version of the library implements it

Example fix

// before
d, err := bindata.Open("bindata://migrations")
// after
as := &bindata.AssetSource{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo}
d, err := bindata.WithInstance(as)
m, err := migrate.NewWithInstance("bindata", d)
Defensive patterns

Strategy: fallback

Try / catch

d, err := bindataDriver.Open(u)
if err != nil {
    // Open is unimplemented for bindata; fall back to WithInstance
    return bindata.WithInstance(assetSource)
}

Prevention

When it happens

Trigger: Calling bindata.Open(url) directly, or database.Open with a bindata:// URL that routes through the driver's Open method (as TestOpen does).

Common situations: Developers assuming all source drivers support URL-based opening; following documentation or examples written for other drivers (file, http) and applying the same pattern to bindata.

Related errors


AI-assisted analysis of golang-migrate/migrate@01a9643f14 (2026-09-02). Data as JSON: /api/errors/efb939c71cbc46db. Report an issue: GitHub.