go 1.13 won't compile

493 views
Skip to first unread message

rob

unread,
Sep 22, 2019, 12:56:47 PM9/22/19
to golang-nuts
Hi.  I think I'm having an issue compiling my code w/ go 1.13.  I have
not had any issues up until now.  I have my code in the default
locations off of ~/go/src w/ a directory for each little bit of code I
wrote.

Running under linuxmint 19.2 amd64, I installed the go binary by first
nuking /usr/local/go, and then

    sudo tar -C /usr/local -xf go1.13.linux-amd64.tar.gz.

When I run go version, I get go version go1.13 linux/amd64

Now when I run

    go install dsrt

I'm getting an error message:

    can't load package: package dsrt: mallformed module path "dsrt" :
missing dot in first path element.

I do not have, need or use a go.mod.  In fact, I don't really understand
them.  And I don't yet understand what vendoring means.

As an aside, I also compile on a win10 amd64 computer.  I installed
windows binary in the usual way on that computer, compiled my code using
go install, and I've not had any issues there.  I only have an issue
here on linuxmint and go 1.13.

What's up?

--rob solomon


Dmitry Savintsev

unread,
Sep 23, 2019, 5:12:17 AM9/23/19
to golang-nuts

> I do not have, need or use a go.mod.

I would still recommend to give it a try - it will likely make your Go dev life easier :)
Try to follow this recipe - you probably don't need to understand much of what's going on "up front" to get your code to build/test:

* assuming your Github / Gitlab etc. username is 'robs', create a directory outside of GOPATH: mkdir -p ~/dev/robs/dsrt
* copy all your code/files from the current place to under ~/dev/robs/dsrt
* cd ~/dev/robs/dsrt
* go mod init github.com/robs/dsrt (or "gitlab.com/robs/dsrt" etc.)  // this should create a go.mod file
* go install -v ./...
* go test -v ./...

See if it works for you, and if not, feel free to share what errors you get.

Robert Solomon

unread,
Sep 23, 2019, 6:00:44 PM9/23/19
to golang-nuts
If I understand you, you want me to not use ~/go/sec? That confuses me. Am I getting expected behavior?

Robert Solomon

unread,
Sep 24, 2019, 8:02:45 AM9/24/19
to golang-nuts
Sometimes I hate autocorrect
I mean ~/go/src

Robert Solomon

unread,
Sep 26, 2019, 2:07:39 PM9/26/19
to golang-nuts
Should I file an issue

Ian Lance Taylor

unread,
Sep 27, 2019, 2:15:42 PM9/27/19
to Robert Solomon, golang-nuts
On Thu, Sep 26, 2019 at 11:08 AM Robert Solomon <drro...@gmail.com> wrote:
>
> Should I file an issue

I recommend that you use package paths whose first element is a domain name.

Ian

Robert Solomon

unread,
Sep 28, 2019, 10:38:06 AM9/28/19
to golang-nuts
I'm getting the sense that my question is below getting an answer I can understand and follow.

Is there a more suitable site for me to post my question without irritating people?

Marcin Romaszewicz

unread,
Sep 28, 2019, 11:43:14 AM9/28/19
to r...@drrob1.com, golang-nuts
What was the last version of Go which worked for you?

"dsrt" isn't a valid module path in the new module resolution code. Does it work if you disable modules - "GO111MODULE=off go install dsrt"?



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3e9c5dad-2fda-9574-d8f9-8cedfb7986e5%40fastmail.com.

rob

unread,
Sep 28, 2019, 2:55:51 PM9/28/19
to Marcin Romaszewicz, golang-nuts

I guess I was not clear enough.  My apologies.  dsrt is my own code.  I remember an earlier posting on this list recommended 'go install' instead of 'go build'

~/go/src/dsrt/dsrt.go, util_linux.go, util_windows.go

And I have written other small programs in go that I use for myself. I put it in https://play.golang.org/p/U7FgzpqCh-B

It compiles and runs fine on go 1.12.x under linux, and fine on go 1.13 under windows 10.  I have not yet installed go1.13.1 on my windows 10 box.

I remember a promise that anything that compiles under go 1.0.0 will not be broken.  Not being able to compile using go 1.13 that works fine using go 1.12.x, broke my code.

I'm not a professional programmer.  I don't know what else to include here to demonstrate my problem.

Thanks for your response.

--rob solomon

You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/5hh--qle2KI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LtsWqufQHw%2BmJtAe60KnCHPag9SPVAtjkP2XzkkuHcwyg%40mail.gmail.com.

Michael Ellis

unread,
Sep 30, 2019, 9:17:19 AM9/30/19
to golang-nuts
FWIW, I copied your code from Go Playground into ~/go/src/dsrt/dsrt.go on my OS X machine.  I replaced an undefined function at line 375 (see below) with direct assignments for usernameStr and groupNameStr. It compiled (with go build) and ran without reporting an error under go 1.13.

// usernameStr, groupnameStr := GetUserGroupStr(f) // util function in platform specific code, only for linux and windows.  Not needed anymore.  Probably won't compile for foreign computer.
                        // GetUserGroupStr() is undefined, so hardcode a couple of nonsense strings to test compilation.
usernameStr := "foo"
groupnameStr := "bar"
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/5hh--qle2KI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golan...@googlegroups.com.

Robert Solomon

unread,
Sep 30, 2019, 10:34:52 AM9/30/19
to Michael Ellis, golang-nuts
Your experience matches mine when compiled on windows 10.

But linuxmint experience is as I described.   Another responder asked me if it works when I set GO111MODULE=no.

It does work when I do that.   I find it interesting that the linux behavior seems to be different 

To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/84d7a41b-5fff-428c-9e10-244ae2cc6a0b%40googlegroups.com.

Everton Marques

unread,
Sep 30, 2019, 11:05:45 AM9/30/19
to golang-nuts
Your code from playground compiled fine for me on Debian Linux.
Tested with Go 1.13 and 1.13.1.

Just had to include the missing func:

func GetUserGroupStr(f os.FileInfo) (string, string) {
       
return "foo", "bar"
}



Em segunda-feira, 30 de setembro de 2019 11:34:52 UTC-3, Robert Solomon escreveu:
Your experience matches mine when compiled on windows 10.

But linuxmint experience is as I described.   Another responder asked me if it works when I set GO111MODULE=no.

It does work when I do that.   I find it interesting that the linux behavior seems to be different 

To unsubscribe from this group and all its topics, send an email to golan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/84d7a41b-5fff-428c-9e10-244ae2cc6a0b%40googlegroups.com.

Robert Solomon

unread,
Sep 30, 2019, 12:14:32 PM9/30/19
to Everton Marques, golang-nuts
Then my question becomes, what's different about linuxmint 19.2 to require me to set GO111MODULE=no 

To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9e61ee25-b953-4947-8134-b3f054d8bb69%40googlegroups.com.

Marcin Romaszewicz

unread,
Sep 30, 2019, 12:21:49 PM9/30/19
to Robert Solomon, Everton Marques, golang-nuts
Could you post the output of "go env" run on linux mint? Maybe there's a clue in there.


To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAJTu_ta-EhDxsoWnMNSvBy-_tKjL_0x-Eb2Jcyf3LKEBQQTkXw%40mail.gmail.com.

rob

unread,
Sep 30, 2019, 1:25:55 PM9/30/19
to Marcin Romaszewicz, Everton Marques, golang-nuts

I hope this helps.  I removed the GO111MODULE=off that I added the other day to get compilation to work.

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rob/.cache/go-build"
GOENV="/home/rob/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/rob/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build194651225=/tmp/go-build -gno-record-gcc-switches"

Michael Ellis

unread,
Sep 30, 2019, 1:28:16 PM9/30/19
to Marcin Romaszewicz, Robert Solomon, Everton Marques, golang-nuts
Robert,
It's probably worth a careful look at https://github.com/golang/go/wiki/Modules#recent-changes and https://golang.org/doc/go1.13#modules as well as Marcin's suggestion to run go env. When I do the latter, I get

GO111MODULE=""
GOPRIVATE=""
(among many other variables but those are probably the important ones). Those settings are working for me for projects that have modules and for projects that don't.

One possibility is that some pieces of version 1.12 are still hanging around.  As you  probably know the recommended approach to upgrading requires removing the older version before installing the new.  See https://golang.org/doc/install#uninstall

Cheers,
Mike

“I want you to act as if the house was on fire. Because it is.” — Greta Thunberg


rob

unread,
Oct 1, 2019, 7:05:18 AM10/1/19
to Michael Ellis, Marcin Romaszewicz, Everton Marques, golang-nuts

I figured out the source of these reported difference in behaviors.

My win10 system does not have a go.mod file, but my LinuxMint system does.  When I deleted that (and unset GO111MODULE) I was able to compile on LinuxMint.

So the differences depend on whether there is already a go.mod file in my ~/go/src directory.

Thanks for all the help guys.

--rob

Reply all
Reply to author
Forward
0 new messages