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

"buffalo build" using Go modules. #1499

Closed
frederikhors opened this Issue Dec 10, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@frederikhors
Copy link

frederikhors commented Dec 10, 2018

I searched everywhere in issues, but found nothing. This thread is good for newcomers, IMO.

Everything works and everything is good with Buffalo and Go modules.

Just one problem: buffalo build.

It makes a file during build: "buffalo_build_main.go":

package main

import (
  "fmt"
  "log"
  "os"
  "os/exec"
  "time"

  "github.com/markbates/grift/grift"
  "github.com/gobuffalo/buffalo/runtime"
  _ "D:/projects/testBuffalo/src/my-project/a"
  _ "D:/projects/testBuffalo/src/my-project/actions"
  
  "github.com/gobuffalo/packr"
  "github.com/gobuffalo/pop"
  "D:/projects/testBuffalo/src/my-project/models"
  
  
  _ "D:/projects/testBuffalo/src/my-project/grifts"
  
)

func init() {
... everything good here

My project is obviously in: "D:/projects/testBuffalo/src/my-project".

The error is:

ERRO[0017] Error: D:\projects\testBuffalo\src\my-project\buffalo_build_main.go:12:5: invalid import path: "D:/projects/testBuffalo/src/my-project/a" (and 3 more errors)

GOPATH=C:\Users\Fred\go;

My go.mod:

module my-project

require (
	github.com/gobuffalo/buffalo v0.13.8
	github.com/gobuffalo/envy v1.6.10
	github.com/gobuffalo/fizz v1.3.0 // indirect
	github.com/gobuffalo/mw-csrf v0.0.0-20180802151833-446ff26e108b
	github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
	github.com/gobuffalo/mw-i18n v0.0.0-20181027200759-09e0c99be4d3
	github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e
	github.com/gobuffalo/packr v1.21.7
  ... and so on

If I use go build it works.

So what I think is maybe something is wrong when generating the file "buffalo_build_main.go".

Am I wrong? What do you think?

This problem can help other people.

Thanks.

UPDATE:

Changing GOPATH worked (but Go modules are for not use anymore GOPATH):

GOPATH=C:\Users\Fred\go;D:\projects\testBuffalo;

I really don't understand.

@lukasschlueter

This comment has been minimized.

Copy link
Member

lukasschlueter commented Dec 13, 2018

I couldn't reproduce on windows.
Can you try again with a new (unaltered) project?

The following sucessfully worked for me:

$ cd go_testing
$ buffalo new water
...
INFO[0059] Congratulations! Your application, water, has been successfully built!

INFO[0059] You can find your new application at:
C:\Users\Lukas\go_testing\src\water
$ cd water
$ buffalo build
INFO[0020]
Your application was successfully built at C:\Users\Lukas\go_testing\src\water\bin\water.exe
$ echo %GOPATH%
C:\Users\Lukas\go

Please also add the output of buffalo info

@markbates

This comment has been minimized.

Copy link
Member

markbates commented Jan 15, 2019

I'm closing this as it's an environmental issue that can be resolved following the instructions here https://gobuffalo.io/en/docs/gomods.

Re-open if the problem persists and you have correctly set up your environment.

@markbates markbates closed this Jan 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment