unclejimbob
unclejimbob

Reputation: 55

Generating a new project in buffalo fails with GO111MODULE issue

I am trying out buffalo for the first time.

I manually installed the pre-requisites rather than using scoop because I didn't know where scoop would put things: https://www.stuartellis.name/articles/windows-golang-setup/#installing-buffalo

Installed buffalo using this from Powershell and it seemed to work OK:

go get -u -v github.com/gobuffalo/buffalo/buffalo

However when I went to generate a new project using this example: https://gobuffalo.io/en/docs/getting-started/new-project/

buffalo new coke

I receive the following.

DEBU[2019-07-17T20:55:51+10:00] Exec: go mod init coke
go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'

If anyone has any idea of what the problem is or how I can avoid it please let me know.

I don't know how to set GO111MODULE within Windows and I've googled this issue for the past 2 hours without success including searches on https://gobuffalo.io

I've tried reinstalling buffalo but this didn't help.

My GOPATH is E:\dev\go

Here is what I issued in order to create a new buffalo project (and I issued it from the correct folder within GOPATH E:\dev\go\src\github.com\):

buffalo new coke

Here is the result from issuing 'go env'.

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\canto\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=e:\dev\go
set GOPROXY=
set GORACE=
set GOROOT=e:\Go
set GOTMPDIR=
set GOTOOLDIR=e:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\canto\AppData\Local\Temp\go-build677176826=/tmp/go-build -gno-record-gcc-switches

I have successfully created a sample 'coke' buffalo project at work however it fails on my home workstation.

Upvotes: 0

Views: 1173

Answers (2)

frankegoesdown
frankegoesdown

Reputation: 1924

GO111MODULE=on go get -u -v github.com/gobuffalo/buffalo/buffalo

https://github.com/golang/go/wiki/Modules here's all you need to know how work with modules

Upvotes: 0

unclejimbob
unclejimbob

Reputation: 55

Started again from scratch, manually uninstalled everything.

Following this: https://www.stuartellis.name/articles/windows-golang-setup/

I just used scoop to create a default install of all the apps; I knew I wouldn't like the result because it put them all on my C:\users\ which is only for my OS

Then I ran buffalo new coke which failed with an error message along the lines of 'you need to be inside GOPATH'

Then I ran buffalo info which gave me all sorts of useful stuff, one of which told me that my PATH needed to match where I was running it from (which I thought was quite clever of it), then light dawned, my path was e:\dev\go and I was running it from E:\dev\go\src. Yes, a capitalization issue. Changed my path to 'E:\dev\go', reran buffalo info and only got warnings about things I wasn't interested in, ran buffalo new coke and it worked.

Now I'm uninstalling scoop and all my scooped apps, changing my custom path using SCOOP and SCOOP_GLOBAL and then re-installing scoop and all the apps again via scoop.

So, capitalization.

Upvotes: 0

Related Questions