go modules installing go tools
I'm using go modules as dependency management, and I'm having problem to install something like this:
go get -u github.com/go-critic/go-critic/...
the result from above was:
go: cannot find main module; see 'go help modules'
go go-modules
add a comment |
I'm using go modules as dependency management, and I'm having problem to install something like this:
go get -u github.com/go-critic/go-critic/...
the result from above was:
go: cannot find main module; see 'go help modules'
go go-modules
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06
add a comment |
I'm using go modules as dependency management, and I'm having problem to install something like this:
go get -u github.com/go-critic/go-critic/...
the result from above was:
go: cannot find main module; see 'go help modules'
go go-modules
I'm using go modules as dependency management, and I'm having problem to install something like this:
go get -u github.com/go-critic/go-critic/...
the result from above was:
go: cannot find main module; see 'go help modules'
go go-modules
go go-modules
asked Nov 19 '18 at 4:09
Luis.at.codeLuis.at.code
233
233
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06
add a comment |
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06
add a comment |
3 Answers
3
active
oldest
votes
If the GO111MODULE
var is to to on
, you have to be inside an initialized go module directory tree in order to use go get
, even if you're trying to get a tool rather than a new dependency. This is a known and heavily debated issue:
https://github.com/golang/go/issues/27643
https://github.com/golang/go/issues/24250
https://github.com/golang/go/issues/25922
The solution, short term, is to run GO111MODULE=off go get <tool>
. This explicitly disables the module support, even if you're in a module package currently, and forces it to only utilize your GOPATH.
Long-term, figuring out what the best solution is to support tool install via go get
(or another command, like go install
with a flag) is an ongoing area of discussion with
little in the way of established consensus as of yet. However, there's a PR open for Go 1.12 that, if accepted, will allow go get
to simply work while outside a module, even with GO111MODULE=on
set.
add a comment |
Try this command
GO111MODULE=on go get -u github.com/go-critic/go-critic/...
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
add a comment |
With Go 1.12 (February 2019), GO111MODULE=on go get
will work.
(From issue 24250)
Modules
When
GO111MODULE
is set toon
, thego
command now supports module-aware operations outside of a module directory, provided that those operations do not need to resolve import paths relative to the current directory or explicitly edit thego.mod
file.
Commands such asgo get
,go list
, andgo mod download
behave as if in a module with initially-empty requirements.
In this mode,go env GOMOD
reports the system's null device (/dev/null
orNUL
).
go
commands that download and extract modules are now safe to invoke concurrently.
The module cache (GOPATH/pkg/mod
) must reside in a filesystem that supports file locking.
The go directive in a
go.mod
file now indicates the version of the language used by the files within that module, andgo mod tidy
sets it to the current release (go 1.12) if no existing version is present.
If the go directive for a module specifies a version newer than the toolchain in use, thego
command will attempt to build the packages regardless, and will note the mismatch only if that build fails.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53368187%2fgo-modules-installing-go-tools%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If the GO111MODULE
var is to to on
, you have to be inside an initialized go module directory tree in order to use go get
, even if you're trying to get a tool rather than a new dependency. This is a known and heavily debated issue:
https://github.com/golang/go/issues/27643
https://github.com/golang/go/issues/24250
https://github.com/golang/go/issues/25922
The solution, short term, is to run GO111MODULE=off go get <tool>
. This explicitly disables the module support, even if you're in a module package currently, and forces it to only utilize your GOPATH.
Long-term, figuring out what the best solution is to support tool install via go get
(or another command, like go install
with a flag) is an ongoing area of discussion with
little in the way of established consensus as of yet. However, there's a PR open for Go 1.12 that, if accepted, will allow go get
to simply work while outside a module, even with GO111MODULE=on
set.
add a comment |
If the GO111MODULE
var is to to on
, you have to be inside an initialized go module directory tree in order to use go get
, even if you're trying to get a tool rather than a new dependency. This is a known and heavily debated issue:
https://github.com/golang/go/issues/27643
https://github.com/golang/go/issues/24250
https://github.com/golang/go/issues/25922
The solution, short term, is to run GO111MODULE=off go get <tool>
. This explicitly disables the module support, even if you're in a module package currently, and forces it to only utilize your GOPATH.
Long-term, figuring out what the best solution is to support tool install via go get
(or another command, like go install
with a flag) is an ongoing area of discussion with
little in the way of established consensus as of yet. However, there's a PR open for Go 1.12 that, if accepted, will allow go get
to simply work while outside a module, even with GO111MODULE=on
set.
add a comment |
If the GO111MODULE
var is to to on
, you have to be inside an initialized go module directory tree in order to use go get
, even if you're trying to get a tool rather than a new dependency. This is a known and heavily debated issue:
https://github.com/golang/go/issues/27643
https://github.com/golang/go/issues/24250
https://github.com/golang/go/issues/25922
The solution, short term, is to run GO111MODULE=off go get <tool>
. This explicitly disables the module support, even if you're in a module package currently, and forces it to only utilize your GOPATH.
Long-term, figuring out what the best solution is to support tool install via go get
(or another command, like go install
with a flag) is an ongoing area of discussion with
little in the way of established consensus as of yet. However, there's a PR open for Go 1.12 that, if accepted, will allow go get
to simply work while outside a module, even with GO111MODULE=on
set.
If the GO111MODULE
var is to to on
, you have to be inside an initialized go module directory tree in order to use go get
, even if you're trying to get a tool rather than a new dependency. This is a known and heavily debated issue:
https://github.com/golang/go/issues/27643
https://github.com/golang/go/issues/24250
https://github.com/golang/go/issues/25922
The solution, short term, is to run GO111MODULE=off go get <tool>
. This explicitly disables the module support, even if you're in a module package currently, and forces it to only utilize your GOPATH.
Long-term, figuring out what the best solution is to support tool install via go get
(or another command, like go install
with a flag) is an ongoing area of discussion with
little in the way of established consensus as of yet. However, there's a PR open for Go 1.12 that, if accepted, will allow go get
to simply work while outside a module, even with GO111MODULE=on
set.
answered Nov 20 '18 at 22:12
KaedysKaedys
4,2981323
4,2981323
add a comment |
add a comment |
Try this command
GO111MODULE=on go get -u github.com/go-critic/go-critic/...
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
add a comment |
Try this command
GO111MODULE=on go get -u github.com/go-critic/go-critic/...
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
add a comment |
Try this command
GO111MODULE=on go get -u github.com/go-critic/go-critic/...
Try this command
GO111MODULE=on go get -u github.com/go-critic/go-critic/...
answered Nov 19 '18 at 4:11
KibGzrKibGzr
1,476610
1,476610
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
add a comment |
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
the magic doesnt work. i already export GO111MODULE=on. what i want is to install cli tools into my $GOPATH/bin directory with GO111MODULE=on. it made the go get tool behave different after turn on the GO111MODULE.
– Luis.at.code
Nov 20 '18 at 5:09
add a comment |
With Go 1.12 (February 2019), GO111MODULE=on go get
will work.
(From issue 24250)
Modules
When
GO111MODULE
is set toon
, thego
command now supports module-aware operations outside of a module directory, provided that those operations do not need to resolve import paths relative to the current directory or explicitly edit thego.mod
file.
Commands such asgo get
,go list
, andgo mod download
behave as if in a module with initially-empty requirements.
In this mode,go env GOMOD
reports the system's null device (/dev/null
orNUL
).
go
commands that download and extract modules are now safe to invoke concurrently.
The module cache (GOPATH/pkg/mod
) must reside in a filesystem that supports file locking.
The go directive in a
go.mod
file now indicates the version of the language used by the files within that module, andgo mod tidy
sets it to the current release (go 1.12) if no existing version is present.
If the go directive for a module specifies a version newer than the toolchain in use, thego
command will attempt to build the packages regardless, and will note the mismatch only if that build fails.
add a comment |
With Go 1.12 (February 2019), GO111MODULE=on go get
will work.
(From issue 24250)
Modules
When
GO111MODULE
is set toon
, thego
command now supports module-aware operations outside of a module directory, provided that those operations do not need to resolve import paths relative to the current directory or explicitly edit thego.mod
file.
Commands such asgo get
,go list
, andgo mod download
behave as if in a module with initially-empty requirements.
In this mode,go env GOMOD
reports the system's null device (/dev/null
orNUL
).
go
commands that download and extract modules are now safe to invoke concurrently.
The module cache (GOPATH/pkg/mod
) must reside in a filesystem that supports file locking.
The go directive in a
go.mod
file now indicates the version of the language used by the files within that module, andgo mod tidy
sets it to the current release (go 1.12) if no existing version is present.
If the go directive for a module specifies a version newer than the toolchain in use, thego
command will attempt to build the packages regardless, and will note the mismatch only if that build fails.
add a comment |
With Go 1.12 (February 2019), GO111MODULE=on go get
will work.
(From issue 24250)
Modules
When
GO111MODULE
is set toon
, thego
command now supports module-aware operations outside of a module directory, provided that those operations do not need to resolve import paths relative to the current directory or explicitly edit thego.mod
file.
Commands such asgo get
,go list
, andgo mod download
behave as if in a module with initially-empty requirements.
In this mode,go env GOMOD
reports the system's null device (/dev/null
orNUL
).
go
commands that download and extract modules are now safe to invoke concurrently.
The module cache (GOPATH/pkg/mod
) must reside in a filesystem that supports file locking.
The go directive in a
go.mod
file now indicates the version of the language used by the files within that module, andgo mod tidy
sets it to the current release (go 1.12) if no existing version is present.
If the go directive for a module specifies a version newer than the toolchain in use, thego
command will attempt to build the packages regardless, and will note the mismatch only if that build fails.
With Go 1.12 (February 2019), GO111MODULE=on go get
will work.
(From issue 24250)
Modules
When
GO111MODULE
is set toon
, thego
command now supports module-aware operations outside of a module directory, provided that those operations do not need to resolve import paths relative to the current directory or explicitly edit thego.mod
file.
Commands such asgo get
,go list
, andgo mod download
behave as if in a module with initially-empty requirements.
In this mode,go env GOMOD
reports the system's null device (/dev/null
orNUL
).
go
commands that download and extract modules are now safe to invoke concurrently.
The module cache (GOPATH/pkg/mod
) must reside in a filesystem that supports file locking.
The go directive in a
go.mod
file now indicates the version of the language used by the files within that module, andgo mod tidy
sets it to the current release (go 1.12) if no existing version is present.
If the go directive for a module specifies a version newer than the toolchain in use, thego
command will attempt to build the packages regardless, and will note the mismatch only if that build fails.
answered Jan 13 at 21:40
VonCVonC
837k29426453184
837k29426453184
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53368187%2fgo-modules-installing-go-tools%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you init main module "go mod init <module name>"? For better understanding go to this stackoverflow question. stackoverflow.com/questions/52328952/…
– samadadi
Nov 19 '18 at 10:56
sorry for the bad description, my problem is to install cli tools into my $GOPATH/bin directory.
– Luis.at.code
Nov 20 '18 at 5:06