Skip to content

Obscure build failures referencing non-existent code with error "undefined: fs in fs.FileMode" #325

Open
@howardjohn

Description

@howardjohn

I am running into some weird issues trying to run go-fuzz-build.

Reproduction steps:

  • git clone http://github.com/istio/istio
  • docker run -v $PWD:$PWD -w $PWD -it --init golang:1.16
  • Inside docker:
    • go get -u github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest
    • cd tests/fuzz
    • go-fuzz-build
failed to execute go build: exit status 2
# k8s.io/client-go/util/homedir
/go/pkg/mod/k8s.io/[email protected]/util/homedir/homedir.go:72: undefined: fs in fs.FileMode

But if we look at the file, there is no fs reference, nor FileMode

# head -n 73 /go/pkg/mod/k8s.io/[email protected]/util/homedir/homedir.go | tail
                        info, err := os.Stat(p)
                        if err != nil {
                                continue
                        }
                        if len(firstExistingPath) == 0 {
                                // remember the first path that exists
                                firstExistingPath = p
                        }
                        if info.IsDir() && info.Mode().Perm()&(1<<(uint(7))) != 0 {
                                // return first path that is writeable

Looking at https://github.com/kubernetes/client-go/blob/master/util/homedir/homedir.go, we can also see there have been no changes since 2019 so its not somehow picking up the wrong version I think

cc @AdamKorcz

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