Skip to content

cmd/go: unable to build test that depends on package with -1.0 in the name #22986

@Zariel

Description

@Zariel

Please answer these questions before submitting your issue. Thanks!

What did you do?

This package fails to compile on tip but works on 1.9.3 https://github.com/jaegertracing/jaeger/tree/master/cmd/agent/app/httpserver where the troublsome folder is thrift-0.9.2 and reduces down to the following I think.

test/a_test.go:

package test

import p "test/p-1.0"
import "testing"

func TestGlobal(t *testing.T) {
	if !p.Global {
		t.Fatal("global false")
	}
}

test/p-1.0/m.go:

package p

var Global = true

func init() {
}

go test -v

This also replicates with go run

What did you expect to see?

=== RUN   TestGlobal
--- PASS: TestGlobal (0.00s)
PASS
ok  	test	0.007s

What did you see instead?

# test (testmain)
test/p-1%!e(MISSING)0.init: call to external function
test.TestGlobal: relocation target test/p-1%2e0.Global not defined
test.init: relocation target test/p-1%2e0.init not defined
test.TestGlobal: undefined: "test/p-1%2e0.Global"
test.init: undefined: "test/p-1%2e0.init"
FAIL	test [build failed]

Does this issue reproduce with the latest release (go1.9.2)?

No

System details

go version devel +1b9f66330b Mon Dec 4 05:15:50 2017 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/chris/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/chris/dev/gotmp"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
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"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tq/6k_qff2j0q5fs4h4_wjd_d1h0000gn/T/go-build120472160=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version devel +1b9f66330b Mon Dec 4 05:15:50 2017 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +1b9f66330b Mon Dec 4 05:15:50 2017 +0000
uname -v: Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29
lldb --version: lldb-900.0.50.1
  Swift-4.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions