fix typos in pkg
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
3f3ba02798
commit
b8047bf930
10 changed files with 12 additions and 12 deletions
|
@ -5,7 +5,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Utsname represents the system name structure.
|
// Utsname represents the system name structure.
|
||||||
// It is passthgrouh for syscall.Utsname in order to make it portable with
|
// It is passthrough for syscall.Utsname in order to make it portable with
|
||||||
// other platforms where it is not available.
|
// other platforms where it is not available.
|
||||||
type Utsname syscall.Utsname
|
type Utsname syscall.Utsname
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
|
||||||
func runtimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
cmd := exec.Command("uname", "-m")
|
cmd := exec.Command("uname", "-m")
|
||||||
machine, err := cmd.Output()
|
machine, err := cmd.Output()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
|
||||||
func runtimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
utsname := &syscall.Utsname{}
|
utsname := &syscall.Utsname{}
|
||||||
if err := syscall.Uname(utsname); err != nil {
|
if err := syscall.Uname(utsname); err != nil {
|
||||||
|
|
|
@ -36,7 +36,7 @@ const (
|
||||||
|
|
||||||
var sysinfo systeminfo
|
var sysinfo systeminfo
|
||||||
|
|
||||||
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
|
||||||
func runtimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
|
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
|
||||||
switch sysinfo.wProcessorArchitecture {
|
switch sysinfo.wProcessorArchitecture {
|
||||||
|
|
|
@ -17,7 +17,7 @@ func init() {
|
||||||
var err error
|
var err error
|
||||||
Architecture, err = runtimeArchitecture()
|
Architecture, err = runtimeArchitecture()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("Could no read system architecture info: %v", err)
|
logrus.Errorf("Could not read system architecture info: %v", err)
|
||||||
}
|
}
|
||||||
OSType = runtime.GOOS
|
OSType = runtime.GOOS
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ var registeredInitializers = make(map[string]func())
|
||||||
// Register adds an initialization func under the specified name
|
// Register adds an initialization func under the specified name
|
||||||
func Register(name string, initializer func()) {
|
func Register(name string, initializer func()) {
|
||||||
if _, exists := registeredInitializers[name]; exists {
|
if _, exists := registeredInitializers[name]; exists {
|
||||||
panic(fmt.Sprintf("reexec func already registred under name %q", name))
|
panic(fmt.Sprintf("reexec func already registered under name %q", name))
|
||||||
}
|
}
|
||||||
|
|
||||||
registeredInitializers[name] = initializer
|
registeredInitializers[name] = initializer
|
||||||
|
|
|
@ -15,7 +15,7 @@ var (
|
||||||
ErrNoSuchKey = errors.New("provided key does not exist")
|
ErrNoSuchKey = errors.New("provided key does not exist")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Registrar stores indexes a list of keys and their registered names as well as indexes names and the key that they are registred to
|
// Registrar stores indexes a list of keys and their registered names as well as indexes names and the key that they are registered to
|
||||||
// Names must be unique.
|
// Names must be unique.
|
||||||
// Registrar is safe for concurrent access.
|
// Registrar is safe for concurrent access.
|
||||||
type Registrar struct {
|
type Registrar struct {
|
||||||
|
|
|
@ -24,7 +24,7 @@ func IsShortID(id string) bool {
|
||||||
// TruncateID returns a shorthand version of a string identifier for convenience.
|
// TruncateID returns a shorthand version of a string identifier for convenience.
|
||||||
// A collision with other shorthands is very unlikely, but possible.
|
// A collision with other shorthands is very unlikely, but possible.
|
||||||
// In case of a collision a lookup with TruncIndex.Get() will fail, and the caller
|
// In case of a collision a lookup with TruncIndex.Get() will fail, and the caller
|
||||||
// will need to use a langer prefix, or the full-length Id.
|
// will need to use a longer prefix, or the full-length Id.
|
||||||
func TruncateID(id string) string {
|
func TruncateID(id string) string {
|
||||||
if i := strings.IndexRune(id, ':'); i >= 0 {
|
if i := strings.IndexRune(id, ':'); i >= 0 {
|
||||||
id = id[i+1:]
|
id = id[i+1:]
|
||||||
|
@ -57,7 +57,7 @@ func generateID(crypto bool) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateRandomID returns an unique id.
|
// GenerateRandomID returns a unique id.
|
||||||
func GenerateRandomID() string {
|
func GenerateRandomID() string {
|
||||||
return generateID(true)
|
return generateID(true)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ func GenerateRandomAlphaOnlyString(n int) string {
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateRandomASCIIString generates an ASCII random stirng with length n.
|
// GenerateRandomASCIIString generates an ASCII random string with length n.
|
||||||
func GenerateRandomASCIIString(n int) string {
|
func GenerateRandomASCIIString(n int) string {
|
||||||
chars := "abcdefghijklmnopqrstuvwxyz" +
|
chars := "abcdefghijklmnopqrstuvwxyz" +
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
||||||
|
@ -74,7 +74,7 @@ func quote(word string, buf *bytes.Buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShellQuoteArguments takes a list of strings and escapes them so they will be
|
// ShellQuoteArguments takes a list of strings and escapes them so they will be
|
||||||
// handled right when passed as arguments to an program via a shell
|
// handled right when passed as arguments to a program via a shell
|
||||||
func ShellQuoteArguments(args []string) string {
|
func ShellQuoteArguments(args []string) string {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Umask sets current process's file mode creation mask to newmask
|
// Umask sets current process's file mode creation mask to newmask
|
||||||
// and return oldmask.
|
// and returns oldmask.
|
||||||
func Umask(newmask int) (oldmask int, err error) {
|
func Umask(newmask int) (oldmask int, err error) {
|
||||||
return syscall.Umask(newmask), nil
|
return syscall.Umask(newmask), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue