Skip to content
Node: process.platformgithub.com/sahilkhaire/gox/osutil

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() string

Compare: Node.js · Standard Go · gox

js
process.platform
go
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()

Back to osutil package overview

MIT Licensed · Built for Node.js developers moving to Go