fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Fresh does not support go mod vendor?

Open developerlaoz opened this issue 6 years ago • 3 comments

Fresh does not support go mod vendor?

I start a project with go mod. When I build and run my project, I can use go build -mod=vendor cmd/main.go and go run -mod=vendor cmd/main.go.

But I can not use fresh, because the source of build step in fresh is cmd := exec.Command("go", "build", "-o", buildPath(), root()).

Am I right? How can I use fresh in my project.

My project folder is : ├── cmd │   └── main.go ├── go.mod ├── go.sum ├── internal ├── runner.conf └── vendor

developerlaoz avatar May 10 '19 06:05 developerlaoz

any progress on this issue?

NiloofarGheibi avatar Jun 27 '19 15:06 NiloofarGheibi

It seems fresh doesn't support go module mode, so I decided to use realize as an alternative for hot reload development.

My project folder is : ├── server │ └── main.go ├── go.mod ├── go.sum └── .realize.yaml (This is the replacement of runner.conf)

.realize.yaml is :

settings:
  legacy:
    force: false
    interval: 0s
schema:
  - name: name
    path: .
    commands:
      install:
        status: true
        method: go build -o tmp/app.out server/main.go
      run:
        status: true
        method: tmp/app.out
    watcher:
      extensions:
        - go
      paths:
        - /
      ignore:
        paths:
          - .git
          - .realize
          - vendor

ref: https://github.com/oxequa/realize/issues/217#issuecomment-459198990

After installing realize, realize start will work fine. 🥳

When you install realize, you may see this error: build github.com/oxequa/realize: cannot load gopkg.in/urfave/cli.v2.

The solution is

go get gopkg.in/urfave/cli.v2@master
GO111MODULE=off go get github.com/oxequa/realize

And please be careful realize seems dead project the same as fresh ☠️

Mizumaki avatar Nov 04 '19 07:11 Mizumaki

Thanks @Mizumaki! Your solution works great!

kinyat avatar Dec 02 '19 02:12 kinyat