How to compile go project on ppc32
Known go support for ppc64
Known go not support for ppc32
Known gccgo can compile Single .go
I want to compile a go project on ppc32
I want use the go toolchain. for example go mod on ppc32
42_ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
if you compile and run .go file successfully on ppc32
then it will do the same in larger projects, but first you should know about project structure in go
and for complex projects there is a lot to speak but for golang
specific this is what I can share.
- create your project root folder at set a project name to it, then run
go mod init {git-repository-address like github.com/usr/project or your desired name}
- create your project structure folders
- each folder which needs a binary output better to have a
cmd
folder inside and you can only have a singlecmd
folder for whole project depends on size of project - after adding some .go files {and their corresponding _test files} in project we should run
go mod tidy
to download dependencies and you can dogo mod vendor
to save dependencies locally at a folder in project root namedvendor
- no you can run specific main function using
go run {project-name}/path-to-go-file
- to run tests you can do
go test ./...
don’t forget to apply linters to your project, for examplegolangci-lint
and you better do it as a git hook before commit - for creating output you can do
go buid {project-name}/path-to-go-file -o {output}
in which you can also cross-compile and useenv GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build {project-name}/path-to-go-file -o {output}
3