Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find module providing package gopkg.in/fsnotify.v1 #178

Open
xianyanglin opened this issue Nov 10, 2020 · 1 comment
Open

cannot find module providing package gopkg.in/fsnotify.v1 #178

xianyanglin opened this issue Nov 10, 2020 · 1 comment

Comments

@xianyanglin
Copy link

hi
I can not run my program~
it show:

go: finding gopkg.in/fsnotify.v1 v1.4.9
go: finding gopkg.in/fsnotify.v1 v1.4.9
build git.code.oa.com/xinghai-go/webDemo: cannot load gopkg.in/fsnotify.v1: cannot find module providing package gopkg.in/fsnotify.v1

@wuxler
Copy link

wuxler commented Nov 19, 2020

hi
I can not run my program~
it show:

go: finding gopkg.in/fsnotify.v1 v1.4.9
go: finding gopkg.in/fsnotify.v1 v1.4.9
build git.code.oa.com/xinghai-go/webDemo: cannot load gopkg.in/fsnotify.v1: cannot find module providing package gopkg.in/fsnotify.v1

It's because package gopkg.in/fsnotify has been renamed as github.com/fsnotify/fsnotify .

There's two ways i supply to fix this problem.

First, copy code of this repo to vendor sub-direcotory in your local project, and change gopkg.in/fsnotify to github.com/fsnotify/fsnotify in watch/inotify.go and watch/inotify_tracker.go

Second, if you use go mod , you can use it directly:

  • Go version: go1.15.3 linux/amd64
  • env variable set as GOPROXY="https://goproxy.cn,direct"
mkdir -p $GOPATH/github.com/wuxler/sample
cd $GOPATH/github.com/wuxler/sample
vim main.go
go mod init
go mod download
go build -o sample main.go

main.go

package main

import (
    "fmt"

    "github.com/hpcloud/tail"
)

func main() {
    t, err := tail.TailFile("/var/log/syslog", tail.Config{Follow: true})
    if err != nil {
        panic(err)
    }
    for line := range t.Lines {
        fmt.Println(line.Text)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants