Closed Matsue closed 4 years ago
Hmm i guess it is because of mvdan.cc/sh v2.6.4+incompatible
in go.mod
. If i try to buid with 1.13 i get the same error and when i check what go get cloned it seems it cloned the master branch where the KillTimeout
things seems to have been refactored a bit.
$ docker run --rm -ti golang:1.13
# github.com/cortesi/modd/cmd/modd
src/github.com/cortesi/modd/cmd/modd/main.go:70:6: r.KillTimeout undefined (type *interp.Runner has no field or method KillTimeout)
$ cd /go/src/mvdan.cc/sh/
$ git show -q HEAD
commit 8b4369601a80e7a662d3ac89b108ef905fcb5f54 (HEAD -> master, origin/master, origin/HEAD)
Author: Konstantin Kulikov <k.kulikov2@gmail.com>
Date: Thu Oct 17 07:30:57 2019 +0300
interp: rename Exec/OpenModule to Exec/OpenHandler
Fixes #425.
I'ved tried many times to understand how the +incompatible
thingy works but failed :) I guess best would be to update to a proper go mod version of the dependency.
Sorry if it's a simple question but I'm new to go and would appreciate the guidance. Since v2.6.4 is specified, why is it cloning master instead of the tagged version? Also, @wader, how can I update to the proper go mod version of the dependency?
See comment below for easier solution
Good question and i'm also confused why this version+incompatible thing seems to somehow use master. I think the proper solution is to make the modd code compatible with the latest mod version of mvdan.cc/sh. I might give a try if not @cortesi beats me to it.
In the meantime this works for me which will use the commit mentioned in go.mod instead of master:
$ git clone https://github.com/cortesi/modd
$ cd modd
$ go get mvdan.cc/sh@8aeb0734cd0f
$ go install ./cmd/modd
Same problem here, @cortesi.
Think i've figured out what is going on. If you do
GO111MODULE=on go get github.com/cortesi/modd/cmd/modd
it will work. What seems to happen is that go get
depending on go version and what the current directory is it will enable or disable module support. When module support is disable i think it will use master branch for all dependencies.
@cortesi Maybe GO111MODULE=on
should be added to the README?
Think i've figured out what is going on. If you do
GO111MODULE=on go get github.com/cortesi/modd/cmd/modd
it will work. What seems to happen is that
go get
depending on go version and what the current directory is it will enable or disable module support. When module support is disable i think it will use master branch for all dependencies.
It will be an annoyance if this command is executed inside a Go mod project.
Modd dependency will be automatically added to go.mod
and go.sum
.
So, this is the workaround:
cd /tmp && GO111MODULE=on go get github.com/cortesi/modd/cmd/modd && cd -
@fahrinh Aha, good to know
Thanks, folks. I've just amended the README to make the recommended install command more robust.
When I try to install modd, I got this error message and the installation fails.
go version