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

Build fails on sitemap.go #93

Closed
gytisrepecka opened this Issue Apr 15, 2019 · 9 comments

Comments

Projects
None yet
5 participants
@gytisrepecka
Copy link

gytisrepecka commented Apr 15, 2019

Describe the bug

Building WriteFreely from source (version 0.9) fails with following error:

go-bindata -pkg writefreely -ignore=\\.gitignore schema.sql sqlite.sql
go get -tags='sqlite' -d -v ./...
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
	ignoring go.mod;
	see 'go help modules'
github.com/mattn/go-sqlite3 (download)
cd cmd/writefreely; go build -ldflags="-X 'github.com/writeas/writefreely.softwareVer=`git describe --tags | cut -c 2-`'" -v -tags='sqlite'
github.com/mattn/go-sqlite3
github.com/writeas/writefreely/parse
github.com/writeas/writefreely
# github.com/writeas/writefreely
../../sitemap.go:23:22: not enough arguments in call to stm.NewSitemap
	have ()
	want (int)
../../sitemap.go:78:4: index must be non-negative integer constant
../../sitemap.go:78:4: cannot use p.Post.Slug.NullString.String (type string) as type []interface {} in array or slice literal
../../sitemap.go:79:4: index must be non-negative integer constant
../../sitemap.go:79:18: cannot use "weekly" (type string) as type []interface {} in array or slice literal
../../sitemap.go:80:4: index must be non-negative integer constant
../../sitemap.go:80:4: cannot use true (type bool) as type []interface {} in array or slice literal
../../sitemap.go:81:4: index must be non-negative integer constant
../../sitemap.go:81:4: cannot use p.Post.Updated (type time.Time) as type []interface {} in array or slice literal
../../sitemap.go:86:33: index must be non-negative integer constant
../../sitemap.go:86:33: too many errors
make: *** [build] Error 2

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. go get -d -u github.com/writeas/writefreely/cmd/writefreely
  2. cd go/src/src/github.com/writeas/writefreely
  3. make build

Building on CentOS 7.

Expected behavior

Build succeeded and writefreely available in go/bin.

Version or last commit:
0.9

@yalh76

This comment has been minimized.

Copy link

yalh76 commented Apr 15, 2019

Same error trying to build for linux/arm64 and linux/amd64

@thebaer

This comment has been minimized.

Copy link
Member

thebaer commented Apr 15, 2019

Can you try building with Go Modules enabled and see if you still get this error?

@yalh76

This comment has been minimized.

Copy link

yalh76 commented Apr 15, 2019

Can you try building with Go Modules enabled and see if you still get this error?

Do you have the command line for that ?
I'm like having no knowledge of Golang....

@diazepan

This comment has been minimized.

Copy link

diazepan commented Apr 16, 2019

It's by adding GO111MODULE=on

What I do is the following:

  1. go get -d github.com/writeas/writefreely/cmd/writefreely
  2. GO111MODULE=on go build github.com/writeas/writefreely/cmd/writefreely
  3. wait until it has errors
  4. Making the assets and the ui
  5. Running again GO111MODULE=on go build github.com/writeas/writefreely/cmd/writefreely

And that worked for me

@gytisrepecka

This comment has been minimized.

Copy link
Author

gytisrepecka commented Apr 16, 2019

In my case prepending all make commands with GO111MODULE=on helped, e.g.:

GO111MODULE=on make build

Thanks, I will make a detailed build documentation as there are few little details (at least on CentOS) :)

@thebaer thebaer added the install label Apr 16, 2019

@thebaer

This comment has been minimized.

Copy link
Member

thebaer commented Apr 16, 2019

@gytisrepecka That would be great! I'll create a "developer" section in the documentation repo that you can add to.

@yalh76

This comment has been minimized.

Copy link

yalh76 commented Apr 16, 2019

In my case prepending all make commands with GO111MODULE=on helped, e.g.:

GO111MODULE=on make build

Thanks, I will make a detailed build documentation as there are few little details (at least on CentOS) :)

For me too, build for ARM64 working

@gytisrepecka

This comment has been minimized.

Copy link
Author

gytisrepecka commented Apr 18, 2019

I have drafted full building walkthrough with mentioned fix, would be nice if someone would also try out on CentOS/RHEL :)

@kaiyou kaiyou referenced this issue Apr 19, 2019

Merged

Fix the build in Docker after enabling go modules #95

1 of 1 task complete
@kaiyou

This comment has been minimized.

Copy link
Collaborator

kaiyou commented Apr 19, 2019

Just pushed the related fixes for the Docker build, thank you for the walkthrough :)

@thebaer thebaer closed this in #95 Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.