go modules installing go tools












4















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 '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
















4















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 '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














4












4








4


2






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 '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



















  • 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












3 Answers
3






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



















    1














    With Go 1.12 (February 2019), GO111MODULE=on go get will work.

    (From issue 24250)



    Modules




    When GO111MODULE is set to on, the go 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 the go.mod file.

    Commands such as go get, go list, and go 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 or NUL).



    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, and go 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, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.







    share|improve this answer























      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

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      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 '18 at 22:12









          KaedysKaedys

          4,2981323




          4,2981323

























              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 '18 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 '18 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 '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



















              • 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











              1














              With Go 1.12 (February 2019), GO111MODULE=on go get will work.

              (From issue 24250)



              Modules




              When GO111MODULE is set to on, the go 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 the go.mod file.

              Commands such as go get, go list, and go 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 or NUL).



              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, and go 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, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.







              share|improve this answer




























                1














                With Go 1.12 (February 2019), GO111MODULE=on go get will work.

                (From issue 24250)



                Modules




                When GO111MODULE is set to on, the go 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 the go.mod file.

                Commands such as go get, go list, and go 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 or NUL).



                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, and go 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, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.







                share|improve this answer


























                  1












                  1








                  1







                  With Go 1.12 (February 2019), GO111MODULE=on go get will work.

                  (From issue 24250)



                  Modules




                  When GO111MODULE is set to on, the go 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 the go.mod file.

                  Commands such as go get, go list, and go 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 or NUL).



                  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, and go 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, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.







                  share|improve this answer













                  With Go 1.12 (February 2019), GO111MODULE=on go get will work.

                  (From issue 24250)



                  Modules




                  When GO111MODULE is set to on, the go 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 the go.mod file.

                  Commands such as go get, go list, and go 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 or NUL).



                  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, and go 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, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 13 at 21:40









                  VonCVonC

                  837k29426453184




                  837k29426453184






























                      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.




                      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

                      鏡平學校

                      ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                      Why https connections are so slow when debugging (stepping over) in Java?