Essential Go Developing for Multiple Platforms with Conditional Compiling  Suggest an edit

Defining separate behaviors in different platforms

Different platforms can have separate implementations of the same method. This example also illustrates how build tags and file suffixes can be used together.

File main.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello World from Conditional Compilation Doc!")
    printDetails()
}

details.go:

// +build !windows

package main

import "fmt"

func printDetails() {
    fmt.Println("Some specific details that cannot be found on Windows")
}

details_windows.go:

package main

import "fmt"

func printDetails() {
    fmt.Println("Windows specific details")
}
  ↑ ↓ to navigate     ↵ to select     Esc to close