Skip to content

ginkgo generate fails in module #524

@mokiat

Description

@mokiat

It seems that running ginkgo generate inside a go module, as per go 1.11, somewhere outside GOPATH results in a broken test skeleton.

Example:

package something_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "UNKNOWN_PACKAGE_PATH"
)

var _ = Describe("Something", func() {

})

The problem likely stems from the usage of ImportDir which does not work with go modules:

pkg, err := build.ImportDir(path, 0)

This has been described here:
golang/go#26504

A workaround is to use the golang.org/x/tools/go/packages package, however it is not stable yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions