Skip to content

x/tools/cmd/stringer: can't find packages #10249

Closed
@randall77

Description

@randall77

I'm having a problem using stringer with go generate. It reports errors because it can't find packages that I think it should be able to find. go build has no trouble finding them.

a.go, in directory $GOPATH/src/a:

package a

import "a/b"

type A int

const (
Aone A = 1
Atwo = 2
Athree = 3
)

//go:generate stringer -type=A

func a() {
b.B()
}

b.go, in directory $GOPATH/src/a/b:

package b

func B() {
}

In $GOPATH/src/a, this happens:

go generate
stringer: checking package: a.go:3:8: could not import a/b (can't find import: a/b)
a.go:13: running "stringer": exit status 1

Running go build instead of go generate works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions