Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: get or build bizarrely fails to resolve imported function within package #20978

Closed
odeke-em opened this issue Jul 11, 2017 · 2 comments
Closed

Comments

@odeke-em
Copy link
Member

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version devel +fcc3514 Fri Jul 7 05:51:55 2017 +0000 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/emmanuelodeke/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/emmanuelodeke/go"
GORACE=""
GOROOT="/Users/emmanuelodeke/go/src/go.googlesource.com/go"
GOTOOLDIR="/Users/emmanuelodeke/go/src/go.googlesource.com/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v3/7z434qpx5v3bw0wh8h2myfpw0000gn/T/go-build296284552=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

Went into a private repo of mine and ran go get

go get -u
package main

import (
	"fmt"

	"github.com/orijtech/otils"
)

func main() {
	fmt.Printf("firstNonEmpty: %q\n", otils.FirstNonEmptyString("", "a", ""))
}

Running go get or go build for the example above works alright though and run prints out

firstNonEmpty: "a"

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

Successful compilation

What did you see instead?

$ go build
# github.com/odeke-em/fb
./fblive.go:52:11: undefined: otils.FirstNonEmptyString

A bizarre error claiming otils.FirstNonEmptyString is undefined, yet running the working sample with the same import on the same computer works alright and here is
http://godoc.org/github.com/orijtech/otils#FirstNonEmptyString
screen shot 2017-07-10 at 10 07 49 pm

Unfortunately I can't guess what's up with the import as this is the first time am seeing this error.

@odeke-em
Copy link
Member Author

Problem also exists on go version go1.8.3 darwin/amd64

@odeke-em
Copy link
Member Author

False alarm, I had a vendor directory in there, somehow but hadn't realized it and the code was stale.

@golang golang locked and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants