Getting Started
CLI
Request handling
- Routing
- Action Controller
- Resources
- Context
- Request Binding
- Middleware
- Error Handling
- Sessions
- Cookies
Frontend
Database
- Getting started with Pop
- Soda CLI
- Database Configuration
- Buffalo Integration
- Models
- Generators
- Migrations
- Fizz
- Mutations
- Querying
- Raw Queries
- Callbacks
- Scoping
- Associations and Relationships
- One to one associations
- One to many associations
Guides
- API Applications
- File Uploads
- Background Job Workers
- Mailers
- Tasks
- Local Authentication
- Third Party Authentication
- Events
- Go Modules
- Localization
- Logging
- Template Engines
- Testing
- Videos
Deploy
Cross-compiling
Deploy
Cross-compiling a Buffalo application
Just like another Go application, you can cross-compile a Buffalo application. This means it’s possible to develop your app on a Mac, and compile it for a Linux target on your Mac.
GOOS and GOARCH
The Go toolchain supports cross-compilation out of the box. You just need to provide the GOOS
and GOARCH
env variables.
GOOS
sets the target OS (e.g. linux, windows, etc.)GOARCH
sets the target CPU architecture (e.g. amd64, 386, etc.)
You can find the list of supported targets here: https://golang.org/doc/install/source#environment
Examples
Build for AMD64 Linux
$ GOOS=linux GOARCH=amd64 buffalo build
Build for ARM64 Linux
$ GOOS=linux GOARCH=arm64 buffalo build
Build for i386 Windows
$ GOOS=windows GOARCH=386 buffalo build