buildHost returns the build machine triplet (e.g., "x86_64-linux-gnu"). This is the machine where the compiler is running, not the target machine.
()
| 199 | // buildHost returns the build machine triplet (e.g., "x86_64-linux-gnu"). |
| 200 | // This is the machine where the compiler is running, not the target machine. |
| 201 | func (p *Platform) buildHost() string { |
| 202 | // Get the processor architecture. |
| 203 | var processor string |
| 204 | switch runtime.GOARCH { |
| 205 | case "amd64": |
| 206 | processor = "x86_64" |
| 207 | case "arm64": |
| 208 | processor = "aarch64" |
| 209 | case "386": |
| 210 | processor = "i686" |
| 211 | case "arm": |
| 212 | processor = "arm" |
| 213 | default: |
| 214 | processor = runtime.GOARCH |
| 215 | } |
| 216 | |
| 217 | // Get the OS. |
| 218 | var os string |
| 219 | switch runtime.GOOS { |
| 220 | case "linux": |
| 221 | os = "linux" |
| 222 | case "windows": |
| 223 | os = "windows" |
| 224 | case "darwin": |
| 225 | os = "apple" |
| 226 | default: |
| 227 | os = runtime.GOOS |
| 228 | } |
| 229 | |
| 230 | // Return triplet format. |
| 231 | switch runtime.GOOS { |
| 232 | case "linux": |
| 233 | return fmt.Sprintf("%s-%s-gnu", processor, os) |
| 234 | case "darwin": |
| 235 | return fmt.Sprintf("%s-%s-darwin", processor, os) |
| 236 | default: |
| 237 | return fmt.Sprintf("%s-%s", processor, os) |
| 238 | } |
| 239 | } |