github.com/bingoohuang/gg@v0.0.0-20240325092523-45da7dee9335/pkg/osx/osx.go (about)

     1  package osx
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/bingoohuang/gg/pkg/osx/env"
     8  )
     9  
    10  func ExitIfErr(err error) {
    11  	if err != nil {
    12  		Exit(err.Error(), 1)
    13  	}
    14  }
    15  
    16  func Exit(msg string, code int) {
    17  	fmt.Fprintln(os.Stderr, msg)
    18  	os.Exit(code)
    19  }
    20  
    21  func EnvSize(envName string, defaultValue int) int {
    22  	return env.Size(envName, defaultValue)
    23  }