go modules installing go tools












3














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'









share|improve this question






















  • 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 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 at 5:06
















3














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'









share|improve this question






















  • 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 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 at 5:06














3












3








3


1





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'









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 4:09









Luis.at.code

183




183












  • 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 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 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 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 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 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 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 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 at 5:06












2 Answers
2






active

oldest

votes


















1














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.






share|improve this answer





























    1














    Try this command
    GO111MODULE=on go get -u github.com/go-critic/go-critic/...






    share|improve this answer





















    • 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 at 5:09











    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
    });


    }
    });














    draft saved

    draft discarded


















    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

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    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.






    share|improve this answer


























      1














      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.






      share|improve this answer
























        1












        1








        1






        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 22:12









        Kaedys

        4,2271223




        4,2271223

























            1














            Try this command
            GO111MODULE=on go get -u github.com/go-critic/go-critic/...






            share|improve this answer





















            • 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 at 5:09
















            1














            Try this command
            GO111MODULE=on go get -u github.com/go-critic/go-critic/...






            share|improve this answer





















            • 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 at 5:09














            1












            1








            1






            Try this command
            GO111MODULE=on go get -u github.com/go-critic/go-critic/...






            share|improve this answer












            Try this command
            GO111MODULE=on go get -u github.com/go-critic/go-critic/...







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 19 at 4:11









            KibGzr

            1,466610




            1,466610












            • 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 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 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 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 at 5:09


















            draft saved

            draft discarded




















































            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen