What to do if go module is broken










1















As Node.js developer I am still new to Golang and struggling with the dependency management in Go. I am using Go 1.11 and applied mod init after importing all my dependencies. One of them is logrus which prevents me from compiling my go application.



The problem:



I believe that the problem is indeed inside of logrus, however I don't know how I could now get another (working) version of logrus, so that I can compile my application again.



/Users/redacted/Documents/redacted3/redacted2>Finished running tool: /usr/local/bin/go vet ./...
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:51: undefined: Logger
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:54: undefined: Fields
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:61: undefined: Level


How can I get rid of these annoying kind of dependency issues?



Relevant import:



log "github.com/sirupsen/logrus"


Go.mod contains



github.com/sirupsen/logrus v1.2.0









share|improve this question
























  • Could we see some code (like your imports) and maybe the go.mod?

    – poy
    Nov 15 '18 at 17:54











  • Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

    – NajlaBioinfo
    Nov 15 '18 at 17:54











  • I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

    – kentor
    Nov 15 '18 at 22:46















1















As Node.js developer I am still new to Golang and struggling with the dependency management in Go. I am using Go 1.11 and applied mod init after importing all my dependencies. One of them is logrus which prevents me from compiling my go application.



The problem:



I believe that the problem is indeed inside of logrus, however I don't know how I could now get another (working) version of logrus, so that I can compile my application again.



/Users/redacted/Documents/redacted3/redacted2>Finished running tool: /usr/local/bin/go vet ./...
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:51: undefined: Logger
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:54: undefined: Fields
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:61: undefined: Level


How can I get rid of these annoying kind of dependency issues?



Relevant import:



log "github.com/sirupsen/logrus"


Go.mod contains



github.com/sirupsen/logrus v1.2.0









share|improve this question
























  • Could we see some code (like your imports) and maybe the go.mod?

    – poy
    Nov 15 '18 at 17:54











  • Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

    – NajlaBioinfo
    Nov 15 '18 at 17:54











  • I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

    – kentor
    Nov 15 '18 at 22:46













1












1








1








As Node.js developer I am still new to Golang and struggling with the dependency management in Go. I am using Go 1.11 and applied mod init after importing all my dependencies. One of them is logrus which prevents me from compiling my go application.



The problem:



I believe that the problem is indeed inside of logrus, however I don't know how I could now get another (working) version of logrus, so that I can compile my application again.



/Users/redacted/Documents/redacted3/redacted2>Finished running tool: /usr/local/bin/go vet ./...
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:51: undefined: Logger
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:54: undefined: Fields
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:61: undefined: Level


How can I get rid of these annoying kind of dependency issues?



Relevant import:



log "github.com/sirupsen/logrus"


Go.mod contains



github.com/sirupsen/logrus v1.2.0









share|improve this question
















As Node.js developer I am still new to Golang and struggling with the dependency management in Go. I am using Go 1.11 and applied mod init after importing all my dependencies. One of them is logrus which prevents me from compiling my go application.



The problem:



I believe that the problem is indeed inside of logrus, however I don't know how I could now get another (working) version of logrus, so that I can compile my application again.



/Users/redacted/Documents/redacted3/redacted2>Finished running tool: /usr/local/bin/go vet ./...
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:51: undefined: Logger
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:54: undefined: Fields
/Users/redacted/go/pkg/mod/github.com/sirupsen/logrus@v1.2.0/entry.go:61: undefined: Level


How can I get rid of these annoying kind of dependency issues?



Relevant import:



log "github.com/sirupsen/logrus"


Go.mod contains



github.com/sirupsen/logrus v1.2.0






go






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 22:46







kentor

















asked Nov 15 '18 at 16:14









kentorkentor

2,75342963




2,75342963












  • Could we see some code (like your imports) and maybe the go.mod?

    – poy
    Nov 15 '18 at 17:54











  • Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

    – NajlaBioinfo
    Nov 15 '18 at 17:54











  • I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

    – kentor
    Nov 15 '18 at 22:46

















  • Could we see some code (like your imports) and maybe the go.mod?

    – poy
    Nov 15 '18 at 17:54











  • Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

    – NajlaBioinfo
    Nov 15 '18 at 17:54











  • I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

    – kentor
    Nov 15 '18 at 22:46
















Could we see some code (like your imports) and maybe the go.mod?

– poy
Nov 15 '18 at 17:54





Could we see some code (like your imports) and maybe the go.mod?

– poy
Nov 15 '18 at 17:54













Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

– NajlaBioinfo
Nov 15 '18 at 17:54





Hi, You may find this [Go (golang) Modules - The Basics : youtube.com/watch?v=B0EjcYaBm9A] interesting. Hope this helps. Good luck.

– NajlaBioinfo
Nov 15 '18 at 17:54













I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

– kentor
Nov 15 '18 at 22:46





I added the relevant import and go mod line. Since only logrus seems to cause trouble I only added this line.

– kentor
Nov 15 '18 at 22:46












2 Answers
2






active

oldest

votes


















1














I had to delete the module in my /go/pkg/mod/github.com/... path which fixed the issue. Appparently something gone wrong while creating the module or initially pulling the code from github.



Afterwards I go get my logrus lib again and it worked as intended.






share|improve this answer























  • I'm glad that you find the solution. Good luck.

    – NajlaBioinfo
    Nov 17 '18 at 14:35











  • I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

    – NajlaBioinfo
    Nov 18 '18 at 21:39



















0














  • I think the logrus module is fine , you just missing the "log.WithFields" definition. Please take a look to the documentation here : https://github.com/sirupsen/logrus . The code below works for me.



  • The main.go file:



    //Source : https://github.com/sirupsen/logrus
    //logrus version : require github.com/sirupsen/logrus v.1.2.0
    //go version go1.11.2 linux/amd64


    package main

    import (
    //Go package
    "os"
    "fmt"
    log "github.com/sirupsen/logrus"
    )

    //Checking if the logout file exist
    //Just to show the Fatal tag.
    func Exists(name string) bool
    _, err := os.Stat(name)
    return !os.IsNotExist(err)



    func main()
    fmt.Println("I'am the main here ... all begin ...")

    log.WithFields(log.Fields"main": "main process",).Info("Initialization.")
    log.WithFields(log.Fields"main": "...some codes....",).Warn("Nothting here yet.")

    log.WithFields(log.Fields"main":"main process",).Info("It's done. Thanks.")

    //The check here (it's just for demo) so you can see the others tags
    if Exists("paht/to/mylogoutfile") == false
    log.WithFields(log.Fields"main": "Checking logoutputfile path.",).Fatal("Mising the Logout file.")


    //fmt.Println("This is the end Thankyou for using this. :) ")




  • The go.mod file:



    module logrustest

    require github.com/sirupsen/logrus v1.2.0 // indirect


  • Output :
    enter image description here


Good luck :)






share|improve this answer




















  • 1





    Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

    – kentor
    Nov 16 '18 at 8:57











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%2f53323607%2fwhat-to-do-if-go-module-is-broken%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














I had to delete the module in my /go/pkg/mod/github.com/... path which fixed the issue. Appparently something gone wrong while creating the module or initially pulling the code from github.



Afterwards I go get my logrus lib again and it worked as intended.






share|improve this answer























  • I'm glad that you find the solution. Good luck.

    – NajlaBioinfo
    Nov 17 '18 at 14:35











  • I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

    – NajlaBioinfo
    Nov 18 '18 at 21:39
















1














I had to delete the module in my /go/pkg/mod/github.com/... path which fixed the issue. Appparently something gone wrong while creating the module or initially pulling the code from github.



Afterwards I go get my logrus lib again and it worked as intended.






share|improve this answer























  • I'm glad that you find the solution. Good luck.

    – NajlaBioinfo
    Nov 17 '18 at 14:35











  • I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

    – NajlaBioinfo
    Nov 18 '18 at 21:39














1












1








1







I had to delete the module in my /go/pkg/mod/github.com/... path which fixed the issue. Appparently something gone wrong while creating the module or initially pulling the code from github.



Afterwards I go get my logrus lib again and it worked as intended.






share|improve this answer













I had to delete the module in my /go/pkg/mod/github.com/... path which fixed the issue. Appparently something gone wrong while creating the module or initially pulling the code from github.



Afterwards I go get my logrus lib again and it worked as intended.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 9:25









kentorkentor

2,75342963




2,75342963












  • I'm glad that you find the solution. Good luck.

    – NajlaBioinfo
    Nov 17 '18 at 14:35











  • I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

    – NajlaBioinfo
    Nov 18 '18 at 21:39


















  • I'm glad that you find the solution. Good luck.

    – NajlaBioinfo
    Nov 17 '18 at 14:35











  • I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

    – NajlaBioinfo
    Nov 18 '18 at 21:39

















I'm glad that you find the solution. Good luck.

– NajlaBioinfo
Nov 17 '18 at 14:35





I'm glad that you find the solution. Good luck.

– NajlaBioinfo
Nov 17 '18 at 14:35













I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

– NajlaBioinfo
Nov 18 '18 at 21:39






I have encountered this problem today after new build (with another package: Gin). Your solution worked for me. Thankyou very much for the trick. :)

– NajlaBioinfo
Nov 18 '18 at 21:39














0














  • I think the logrus module is fine , you just missing the "log.WithFields" definition. Please take a look to the documentation here : https://github.com/sirupsen/logrus . The code below works for me.



  • The main.go file:



    //Source : https://github.com/sirupsen/logrus
    //logrus version : require github.com/sirupsen/logrus v.1.2.0
    //go version go1.11.2 linux/amd64


    package main

    import (
    //Go package
    "os"
    "fmt"
    log "github.com/sirupsen/logrus"
    )

    //Checking if the logout file exist
    //Just to show the Fatal tag.
    func Exists(name string) bool
    _, err := os.Stat(name)
    return !os.IsNotExist(err)



    func main()
    fmt.Println("I'am the main here ... all begin ...")

    log.WithFields(log.Fields"main": "main process",).Info("Initialization.")
    log.WithFields(log.Fields"main": "...some codes....",).Warn("Nothting here yet.")

    log.WithFields(log.Fields"main":"main process",).Info("It's done. Thanks.")

    //The check here (it's just for demo) so you can see the others tags
    if Exists("paht/to/mylogoutfile") == false
    log.WithFields(log.Fields"main": "Checking logoutputfile path.",).Fatal("Mising the Logout file.")


    //fmt.Println("This is the end Thankyou for using this. :) ")




  • The go.mod file:



    module logrustest

    require github.com/sirupsen/logrus v1.2.0 // indirect


  • Output :
    enter image description here


Good luck :)






share|improve this answer




















  • 1





    Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

    – kentor
    Nov 16 '18 at 8:57
















0














  • I think the logrus module is fine , you just missing the "log.WithFields" definition. Please take a look to the documentation here : https://github.com/sirupsen/logrus . The code below works for me.



  • The main.go file:



    //Source : https://github.com/sirupsen/logrus
    //logrus version : require github.com/sirupsen/logrus v.1.2.0
    //go version go1.11.2 linux/amd64


    package main

    import (
    //Go package
    "os"
    "fmt"
    log "github.com/sirupsen/logrus"
    )

    //Checking if the logout file exist
    //Just to show the Fatal tag.
    func Exists(name string) bool
    _, err := os.Stat(name)
    return !os.IsNotExist(err)



    func main()
    fmt.Println("I'am the main here ... all begin ...")

    log.WithFields(log.Fields"main": "main process",).Info("Initialization.")
    log.WithFields(log.Fields"main": "...some codes....",).Warn("Nothting here yet.")

    log.WithFields(log.Fields"main":"main process",).Info("It's done. Thanks.")

    //The check here (it's just for demo) so you can see the others tags
    if Exists("paht/to/mylogoutfile") == false
    log.WithFields(log.Fields"main": "Checking logoutputfile path.",).Fatal("Mising the Logout file.")


    //fmt.Println("This is the end Thankyou for using this. :) ")




  • The go.mod file:



    module logrustest

    require github.com/sirupsen/logrus v1.2.0 // indirect


  • Output :
    enter image description here


Good luck :)






share|improve this answer




















  • 1





    Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

    – kentor
    Nov 16 '18 at 8:57














0












0








0







  • I think the logrus module is fine , you just missing the "log.WithFields" definition. Please take a look to the documentation here : https://github.com/sirupsen/logrus . The code below works for me.



  • The main.go file:



    //Source : https://github.com/sirupsen/logrus
    //logrus version : require github.com/sirupsen/logrus v.1.2.0
    //go version go1.11.2 linux/amd64


    package main

    import (
    //Go package
    "os"
    "fmt"
    log "github.com/sirupsen/logrus"
    )

    //Checking if the logout file exist
    //Just to show the Fatal tag.
    func Exists(name string) bool
    _, err := os.Stat(name)
    return !os.IsNotExist(err)



    func main()
    fmt.Println("I'am the main here ... all begin ...")

    log.WithFields(log.Fields"main": "main process",).Info("Initialization.")
    log.WithFields(log.Fields"main": "...some codes....",).Warn("Nothting here yet.")

    log.WithFields(log.Fields"main":"main process",).Info("It's done. Thanks.")

    //The check here (it's just for demo) so you can see the others tags
    if Exists("paht/to/mylogoutfile") == false
    log.WithFields(log.Fields"main": "Checking logoutputfile path.",).Fatal("Mising the Logout file.")


    //fmt.Println("This is the end Thankyou for using this. :) ")




  • The go.mod file:



    module logrustest

    require github.com/sirupsen/logrus v1.2.0 // indirect


  • Output :
    enter image description here


Good luck :)






share|improve this answer















  • I think the logrus module is fine , you just missing the "log.WithFields" definition. Please take a look to the documentation here : https://github.com/sirupsen/logrus . The code below works for me.



  • The main.go file:



    //Source : https://github.com/sirupsen/logrus
    //logrus version : require github.com/sirupsen/logrus v.1.2.0
    //go version go1.11.2 linux/amd64


    package main

    import (
    //Go package
    "os"
    "fmt"
    log "github.com/sirupsen/logrus"
    )

    //Checking if the logout file exist
    //Just to show the Fatal tag.
    func Exists(name string) bool
    _, err := os.Stat(name)
    return !os.IsNotExist(err)



    func main()
    fmt.Println("I'am the main here ... all begin ...")

    log.WithFields(log.Fields"main": "main process",).Info("Initialization.")
    log.WithFields(log.Fields"main": "...some codes....",).Warn("Nothting here yet.")

    log.WithFields(log.Fields"main":"main process",).Info("It's done. Thanks.")

    //The check here (it's just for demo) so you can see the others tags
    if Exists("paht/to/mylogoutfile") == false
    log.WithFields(log.Fields"main": "Checking logoutputfile path.",).Fatal("Mising the Logout file.")


    //fmt.Println("This is the end Thankyou for using this. :) ")




  • The go.mod file:



    module logrustest

    require github.com/sirupsen/logrus v1.2.0 // indirect


  • Output :
    enter image description here


Good luck :)







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 16 '18 at 7:46

























answered Nov 16 '18 at 7:40









NajlaBioinfoNajlaBioinfo

50135




50135







  • 1





    Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

    – kentor
    Nov 16 '18 at 8:57













  • 1





    Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

    – kentor
    Nov 16 '18 at 8:57








1




1





Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

– kentor
Nov 16 '18 at 8:57






Indeed I am using it just like you, I still believe that I got a broken version of the code. I looked into the logrus package ../../../go/pkg/mod/github.com/sirupsen/logrus@v1.2.0: here and just like the error indicates this package has NO type Logger defined. So how could I redownload the package/module which maybe fixes this? This folder does not contain a Logger.go file for some reason..

– kentor
Nov 16 '18 at 8:57


















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%2f53323607%2fwhat-to-do-if-go-module-is-broken%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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3