common

package
v0.0.0-...-69178d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package common contains common utilities that are shared among other packages. See each sub-package for detail.

This code is a repurposed code from Project V, under open source license https://github.com/v2fly/v2ray-core

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route.
	ErrNoClue = errors.New("not enough information for making a decision")
)

Functions

func Error2

func Error2(v interface{}, err error) error

Error2 returns the err from the 2nd parameter.

func GetGOBIN

func GetGOBIN() string

GetGOBIN returns GOBIN environment variable as a string. It will NOT be empty.

func GetGOPATH

func GetGOPATH() string

GetGOPATH returns GOPATH environment variable as a string. It will NOT be empty.

func GetModuleName

func GetModuleName(pathToProjectRoot string) (string, error)

GetModuleName returns the value of module in `go.mod` file.

func GetRuntimeEnv

func GetRuntimeEnv(key string) (string, error)

GetRuntimeEnv returns the value of runtime environment variable, that is set by running following command: `go env -w key=value`.

func Must

func Must(err error)

Must panics if err is not nil.

func Must2

func Must2(v interface{}, err error) interface{}

Must2 panics if the second parameter is not nil, otherwise returns the first parameter.

Types

This section is empty.

Directories

Path Synopsis
Package errors is a drop-in replacement for Golang lib 'errors'.
Package errors is a drop-in replacement for Golang lib 'errors'.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL