diff --git a/README.md b/README.md index 11f0f7f..42d1b8f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_633 TILs and counting..._ +_634 TILs and counting..._ --- @@ -206,6 +206,7 @@ _633 TILs and counting..._ ### Go - [Access Go Docs Offline](go/access-go-docs-offline.md) +- [Build For A Specific OS And Architecture](go/build-for-a-specific-os-and-architecture.md) - [Not So Random](go/not-so-random.md) - [Replace The Current Process With An External Command](go/replace-the-current-process-with-an-external-command.md) - [Sleep For A Duration](go/sleep-for-a-duration.md) diff --git a/go/build-for-a-specific-os-and-architecture.md b/go/build-for-a-specific-os-and-architecture.md new file mode 100644 index 0000000..324a27f --- /dev/null +++ b/go/build-for-a-specific-os-and-architecture.md @@ -0,0 +1,17 @@ +# Build For A Specific OS and Architecture + +Go programs can run anywhere, but you've got to create builds specific to +each operating system and architecture. This can be done when building by +specifying the `GOOS` and `GOARCH` environment variables. + +For example, if you'd like to build a 32-bit Linux distribution: + +```bash +GOOS=linux GOARCH=386 go build -o linux_386_build +``` + +The `GOOS` value specifies the operating system as Linux and the `GOARCH` +value of `386` specifies a 32-bit architecture. + +The plethora of `GOOS` and `GOARCH` options can be found +[here](https://golang.org/doc/install/source#environment).