Platform
Overview
Platform returns the OS (runtime.GOOS).
If you are coming from Node.js, the closest pattern is process.platform.
Signature
go
func Platform() stringCompare: Node.js · Standard Go · gox
js
process.platformgo
val, err := os.Platform()go
import "github.com/sahilkhaire/gox/osutil"
osutil.Platform()Example
go
import "github.com/sahilkhaire/gox/osutil"
osutil.Platform()Tips
Import github.com/sahilkhaire/gox/osutil and call Platform directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
val, err := os.Platform()