Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
This commit is contained in:
parent
df5dc52c05
commit
244162287a
33 changed files with 39 additions and 39 deletions
|
@ -31,7 +31,7 @@ type (
|
||||||
Archive io.ReadCloser
|
Archive io.ReadCloser
|
||||||
// Reader is a type of io.Reader.
|
// Reader is a type of io.Reader.
|
||||||
Reader io.Reader
|
Reader io.Reader
|
||||||
// Compression is the state represtents if compressed or not.
|
// Compression is the state represents if compressed or not.
|
||||||
Compression int
|
Compression int
|
||||||
// TarChownOptions wraps the chown options UID and GID.
|
// TarChownOptions wraps the chown options UID and GID.
|
||||||
TarChownOptions struct {
|
TarChownOptions struct {
|
||||||
|
|
|
@ -19,7 +19,7 @@ func fixVolumePathPrefix(srcPath string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
||||||
// We use a seperate function as this is platform specific. On Linux, we
|
// We use a separate function as this is platform specific. On Linux, we
|
||||||
// can't use filepath.Join(srcPath,include) because this will clean away
|
// can't use filepath.Join(srcPath,include) because this will clean away
|
||||||
// a trailing "." or "/" which may be important.
|
// a trailing "." or "/" which may be important.
|
||||||
func getWalkRoot(srcPath string, include string) string {
|
func getWalkRoot(srcPath string, include string) string {
|
||||||
|
|
|
@ -19,7 +19,7 @@ func fixVolumePathPrefix(srcPath string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
||||||
// We use a seperate function as this is platform specific.
|
// We use a separate function as this is platform specific.
|
||||||
func getWalkRoot(srcPath string, include string) string {
|
func getWalkRoot(srcPath string, include string) string {
|
||||||
return filepath.Join(srcPath, include)
|
return filepath.Join(srcPath, include)
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ func Changes(layers []string, rw string) ([]Change, error) {
|
||||||
|
|
||||||
// If /foo/bar/file.txt is modified, then /foo/bar must be part of the changed files.
|
// If /foo/bar/file.txt is modified, then /foo/bar must be part of the changed files.
|
||||||
// This block is here to ensure the change is recorded even if the
|
// This block is here to ensure the change is recorded even if the
|
||||||
// modify time, mode and size of the parent directoriy in the rw and ro layers are all equal.
|
// modify time, mode and size of the parent directory in the rw and ro layers are all equal.
|
||||||
// Check https://github.com/docker/docker/pull/13590 for details.
|
// Check https://github.com/docker/docker/pull/13590 for details.
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
changedDirs[path] = struct{}{}
|
changedDirs[path] = struct{}{}
|
||||||
|
|
|
@ -9,7 +9,7 @@ package archive
|
||||||
const WhiteoutPrefix = ".wh."
|
const WhiteoutPrefix = ".wh."
|
||||||
|
|
||||||
// WhiteoutMetaPrefix prefix means whiteout has a special meaning and is not
|
// WhiteoutMetaPrefix prefix means whiteout has a special meaning and is not
|
||||||
// for remoing an actaul file. Normally these files are excluded from exported
|
// for removing an actual file. Normally these files are excluded from exported
|
||||||
// archives.
|
// archives.
|
||||||
const WhiteoutMetaPrefix = WhiteoutPrefix + WhiteoutPrefix
|
const WhiteoutMetaPrefix = WhiteoutPrefix + WhiteoutPrefix
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
|
||||||
func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
|
func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
|
||||||
|
|
||||||
// Try to retrieve the next available loopback device via syscall.
|
// Try to retrieve the next available loopback device via syscall.
|
||||||
// If it fails, we discard error and start loopking for a
|
// If it fails, we discard error and start looping for a
|
||||||
// loopback from index 0.
|
// loopback from index 0.
|
||||||
startIndex, err := getNextFreeLoopbackIndex()
|
startIndex, err := getNextFreeLoopbackIndex()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -290,7 +290,7 @@ func (s *FakeStore) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVP
|
||||||
}
|
}
|
||||||
|
|
||||||
// WatchTree will fail the first time, and return the mockKVchan afterwards.
|
// WatchTree will fail the first time, and return the mockKVchan afterwards.
|
||||||
// This is the behaviour we need for testing.. If we need 'moar', should update this.
|
// This is the behavior we need for testing.. If we need 'moar', should update this.
|
||||||
func (s *FakeStore) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
|
func (s *FakeStore) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
|
||||||
if s.watchTreeCallCount == 0 {
|
if s.watchTreeCallCount == 0 {
|
||||||
s.watchTreeCallCount = 1
|
s.watchTreeCallCount = 1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Package filenotify provides a mechanism for watching file(s) for changes.
|
// Package filenotify provides a mechanism for watching file(s) for changes.
|
||||||
// Generally leans on fsnotify, but provides a poll-based notifier which fsnotify does not support.
|
// Generally leans on fsnotify, but provides a poll-based notifier which fsnotify does not support.
|
||||||
// These are wrapped up in a common interface so that either can be used interchangably in your code.
|
// These are wrapped up in a common interface so that either can be used interchangeably in your code.
|
||||||
package filenotify
|
package filenotify
|
||||||
|
|
||||||
import "gopkg.in/fsnotify.v1"
|
import "gopkg.in/fsnotify.v1"
|
||||||
|
|
|
@ -24,7 +24,7 @@ const watchWaitTime = 200 * time.Millisecond
|
||||||
|
|
||||||
// filePoller is used to poll files for changes, especially in cases where fsnotify
|
// filePoller is used to poll files for changes, especially in cases where fsnotify
|
||||||
// can't be run (e.g. when inotify handles are exhausted)
|
// can't be run (e.g. when inotify handles are exhausted)
|
||||||
// filePoller satifies the FileWatcher interface
|
// filePoller satisfies the FileWatcher interface
|
||||||
type filePoller struct {
|
type filePoller struct {
|
||||||
// watches is the list of files currently being polled, close the associated channel to stop the watch
|
// watches is the list of files currently being polled, close the associated channel to stop the watch
|
||||||
watches map[string]chan struct{}
|
watches map[string]chan struct{}
|
||||||
|
|
|
@ -78,7 +78,7 @@ func Matches(file string, patterns []string) (bool, error) {
|
||||||
|
|
||||||
// OptimizedMatches is basically the same as fileutils.Matches() but optimized for archive.go.
|
// OptimizedMatches is basically the same as fileutils.Matches() but optimized for archive.go.
|
||||||
// It will assume that the inputs have been preprocessed and therefore the function
|
// It will assume that the inputs have been preprocessed and therefore the function
|
||||||
// doen't need to do as much error checking and clean-up. This was done to avoid
|
// doesn't need to do as much error checking and clean-up. This was done to avoid
|
||||||
// repeating these steps on each file being checked during the archive process.
|
// repeating these steps on each file being checked during the archive process.
|
||||||
// The more generic fileutils.Matches() can't make these assumptions.
|
// The more generic fileutils.Matches() can't make these assumptions.
|
||||||
func OptimizedMatches(file string, patterns []string, patDirs [][]string) (bool, error) {
|
func OptimizedMatches(file string, patterns []string, patDirs [][]string) (bool, error) {
|
||||||
|
|
|
@ -295,7 +295,7 @@ func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseCgroupPaths arses 'procCgroupData', which is output of '/proc/<pid>/cgroup', and returns
|
// ParseCgroupPaths parses 'procCgroupData', which is output of '/proc/<pid>/cgroup', and returns
|
||||||
// a map which cgroup name as key and path as value.
|
// a map which cgroup name as key and path as value.
|
||||||
func ParseCgroupPaths(procCgroupData string) map[string]string {
|
func ParseCgroupPaths(procCgroupData string) map[string]string {
|
||||||
cgroupPaths := map[string]string{}
|
cgroupPaths := map[string]string{}
|
||||||
|
@ -337,7 +337,7 @@ func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunAtDifferentDate runs the specifed function with the given time.
|
// RunAtDifferentDate runs the specified function with the given time.
|
||||||
// It changes the date of the system, which can led to weird behaviors.
|
// It changes the date of the system, which can led to weird behaviors.
|
||||||
func RunAtDifferentDate(date time.Time, block func()) {
|
func RunAtDifferentDate(date time.Time, block func()) {
|
||||||
// Layout for date. MMDDhhmmYYYY
|
// Layout for date. MMDDhhmmYYYY
|
||||||
|
|
|
@ -309,7 +309,7 @@ func TestCompareDirectoryEntries(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME make an "unhappy path" test for ListTar without "panicing" :-)
|
// FIXME make an "unhappy path" test for ListTar without "panicking" :-)
|
||||||
func TestListTar(t *testing.T) {
|
func TestListTar(t *testing.T) {
|
||||||
tmpFolder, err := ioutil.TempDir("", "integration-cli-utils-list-tar")
|
tmpFolder, err := ioutil.TempDir("", "integration-cli-utils-list-tar")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -20,7 +20,7 @@ func NopWriteCloser(w io.Writer) io.WriteCloser {
|
||||||
return &nopWriteCloser{w}
|
return &nopWriteCloser{w}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NopFlusher represents a type which flush opetatin is nop.
|
// NopFlusher represents a type which flush operation is nop.
|
||||||
type NopFlusher struct{}
|
type NopFlusher struct{}
|
||||||
|
|
||||||
// Flush is a nop operation.
|
// Flush is a nop operation.
|
||||||
|
|
|
@ -19,8 +19,8 @@ type JSONLog struct {
|
||||||
|
|
||||||
// Format returns the log formatted according to format
|
// Format returns the log formatted according to format
|
||||||
// If format is nil, returns the log message
|
// If format is nil, returns the log message
|
||||||
// If format is json, returns the log marshalled in json format
|
// If format is json, returns the log marshaled in json format
|
||||||
// By defalut, returns the log with the log time formatted according to format.
|
// By default, returns the log with the log time formatted according to format.
|
||||||
func (jl *JSONLog) Format(format string) (string, error) {
|
func (jl *JSONLog) Format(format string) (string, error) {
|
||||||
if format == "" {
|
if format == "" {
|
||||||
return jl.Log, nil
|
return jl.Log, nil
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (p *JSONProgress) String() string {
|
||||||
percentage = 50
|
percentage = 50
|
||||||
}
|
}
|
||||||
if width > 110 {
|
if width > 110 {
|
||||||
// this number can't be negetive gh#7136
|
// this number can't be negative gh#7136
|
||||||
numSpaces := 0
|
numSpaces := 0
|
||||||
if 50-percentage > 0 {
|
if 50-percentage > 0 {
|
||||||
numSpaces = 50 - percentage
|
numSpaces = 50 - percentage
|
||||||
|
@ -106,7 +106,7 @@ type JSONMessage struct {
|
||||||
|
|
||||||
// Display displays the JSONMessage to `out`. `isTerminal` describes if `out`
|
// Display displays the JSONMessage to `out`. `isTerminal` describes if `out`
|
||||||
// is a terminal. If this is the case, it will erase the entire current line
|
// is a terminal. If this is the case, it will erase the entire current line
|
||||||
// when dislaying the progressbar.
|
// when displaying the progressbar.
|
||||||
func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
||||||
if jm.Error != nil {
|
if jm.Error != nil {
|
||||||
if jm.Error.Code == 401 {
|
if jm.Error.Code == 401 {
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (l *lockCtr) inc() {
|
||||||
atomic.AddInt32(&l.waiters, 1)
|
atomic.AddInt32(&l.waiters, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dec decrements the number of waiters wating on the lock
|
// dec decrements the number of waiters waiting on the lock
|
||||||
func (l *lockCtr) dec() {
|
func (l *lockCtr) dec() {
|
||||||
atomic.AddInt32(&l.waiters, -1)
|
atomic.AddInt32(&l.waiters, -1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1228,7 +1228,7 @@ func (v mergeVal) IsBoolFlag() bool {
|
||||||
|
|
||||||
// Merge is an helper function that merges n FlagSets into a single dest FlagSet
|
// Merge is an helper function that merges n FlagSets into a single dest FlagSet
|
||||||
// In case of name collision between the flagsets it will apply
|
// In case of name collision between the flagsets it will apply
|
||||||
// the destination FlagSet's errorHandling behaviour.
|
// the destination FlagSet's errorHandling behavior.
|
||||||
func Merge(dest *FlagSet, flagsets ...*FlagSet) error {
|
func Merge(dest *FlagSet, flagsets ...*FlagSet) error {
|
||||||
for _, fset := range flagsets {
|
for _, fset := range flagsets {
|
||||||
for k, f := range fset.formal {
|
for k, f := range fset.formal {
|
||||||
|
|
|
@ -23,7 +23,7 @@ const (
|
||||||
SYNCHRONOUS = syscall.MS_SYNCHRONOUS
|
SYNCHRONOUS = syscall.MS_SYNCHRONOUS
|
||||||
|
|
||||||
// DIRSYNC will force all directory updates within the file system to be done
|
// DIRSYNC will force all directory updates within the file system to be done
|
||||||
// synchronously. This affects the following system calls: creat, link,
|
// synchronously. This affects the following system calls: create, link,
|
||||||
// unlink, symlink, mkdir, rmdir, mknod and rename.
|
// unlink, symlink, mkdir, rmdir, mknod and rename.
|
||||||
DIRSYNC = syscall.MS_DIRSYNC
|
DIRSYNC = syscall.MS_DIRSYNC
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ func TestSubtreeShared(t *testing.T) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// NOW, check that the file from the outside directory is avaible in the source directory
|
// NOW, check that the file from the outside directory is available in the source directory
|
||||||
if _, err := os.Stat(sourceCheckPath); err != nil {
|
if _, err := os.Stat(sourceCheckPath); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (filters Args) Len() int {
|
||||||
return len(filters.fields)
|
return len(filters.fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchKVList returns true if the values for the specified field maches the ones
|
// MatchKVList returns true if the values for the specified field matches the ones
|
||||||
// from the sources.
|
// from the sources.
|
||||||
// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}},
|
// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}},
|
||||||
// field is 'label' and sources are {'label1': '1', 'label2': '2'}
|
// field is 'label' and sources are {'label1': '1', 'label2': '2'}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Rand is a global *rand.Rand instance, which initilized with NewSource() source.
|
// Rand is a global *rand.Rand instance, which initialized with NewSource() source.
|
||||||
var Rand = rand.New(NewSource())
|
var Rand = rand.New(NewSource())
|
||||||
|
|
||||||
// Reader is a global, shared instance of a pseudorandom bytes generator.
|
// Reader is a global, shared instance of a pseudorandom bytes generator.
|
||||||
|
|
|
@ -41,7 +41,7 @@ func naiveSelf() string {
|
||||||
if absName, err := filepath.Abs(name); err == nil {
|
if absName, err := filepath.Abs(name); err == nil {
|
||||||
return absName
|
return absName
|
||||||
}
|
}
|
||||||
// if we coudn't get absolute name, return original
|
// if we couldn't get absolute name, return original
|
||||||
// (NOTE: Go only errors on Abs() if os.Getwd fails)
|
// (NOTE: Go only errors on Abs() if os.Getwd fails)
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (sf *StreamFormatter) FormatStatus(id, format string, a ...interface{}) []b
|
||||||
return []byte(str + streamNewline)
|
return []byte(str + streamNewline)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FormatError formats the specifed error.
|
// FormatError formats the specified error.
|
||||||
func (sf *StreamFormatter) FormatError(err error) []byte {
|
func (sf *StreamFormatter) FormatError(err error) []byte {
|
||||||
if sf.json {
|
if sf.json {
|
||||||
jsonError, ok := err.(*jsonmessage.JSONError)
|
jsonError, ok := err.(*jsonmessage.JSONError)
|
||||||
|
|
|
@ -48,7 +48,7 @@ func generateID(crypto bool) string {
|
||||||
}
|
}
|
||||||
id := hex.EncodeToString(b)
|
id := hex.EncodeToString(b)
|
||||||
// if we try to parse the truncated for as an int and we don't have
|
// if we try to parse the truncated for as an int and we don't have
|
||||||
// an error then the value is all numberic and causes issues when
|
// an error then the value is all numeric and causes issues when
|
||||||
// used as a hostname. ref #3869
|
// used as a hostname. ref #3869
|
||||||
if _, err := strconv.ParseInt(TruncateID(id), 10, 64); err == nil {
|
if _, err := strconv.ParseInt(TruncateID(id), 10, 64); err == nil {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StrSlice representes a string or an array of strings.
|
// StrSlice represents a string or an array of strings.
|
||||||
// We need to override the json decoder to accept both options.
|
// We need to override the json decoder to accept both options.
|
||||||
type StrSlice struct {
|
type StrSlice struct {
|
||||||
parts []string
|
parts []string
|
||||||
|
|
|
@ -91,7 +91,7 @@ func walkSymlinks(path string) (string, error) {
|
||||||
return "", errors.New("EvalSymlinks: too many links in " + originalPath)
|
return "", errors.New("EvalSymlinks: too many links in " + originalPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A path beginnging with `\\?\` represents the root, so automatically
|
// A path beginning with `\\?\` represents the root, so automatically
|
||||||
// skip that part and begin processing the next segment.
|
// skip that part and begin processing the next segment.
|
||||||
if strings.HasPrefix(path, longpath.Prefix) {
|
if strings.HasPrefix(path, longpath.Prefix) {
|
||||||
b.WriteString(longpath.Prefix)
|
b.WriteString(longpath.Prefix)
|
||||||
|
|
|
@ -36,7 +36,7 @@ type cgroupMemInfo struct {
|
||||||
// Whether soft limit is supported or not
|
// Whether soft limit is supported or not
|
||||||
MemoryReservation bool
|
MemoryReservation bool
|
||||||
|
|
||||||
// Whether OOM killer disalbe is supported or not
|
// Whether OOM killer disable is supported or not
|
||||||
OomKillDisable bool
|
OomKillDisable bool
|
||||||
|
|
||||||
// Whether memory swappiness is supported or not
|
// Whether memory swappiness is supported or not
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LUtimesNano is used to change access and modification time of the speficied path.
|
// LUtimesNano is used to change access and modification time of the specified path.
|
||||||
// It's used for symbol link file because syscall.UtimesNano doesn't support a NOFOLLOW flag atm.
|
// It's used for symbol link file because syscall.UtimesNano doesn't support a NOFOLLOW flag atm.
|
||||||
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
// These are not currently available in syscall
|
// These are not currently available in syscall
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "sort"
|
||||||
|
|
||||||
// FileInfoSumInterface provides an interface for accessing file checksum
|
// FileInfoSumInterface provides an interface for accessing file checksum
|
||||||
// information within a tar file. This info is accessed through interface
|
// information within a tar file. This info is accessed through interface
|
||||||
// so the actual name and sum cannot be medled with.
|
// so the actual name and sum cannot be melded with.
|
||||||
type FileInfoSumInterface interface {
|
type FileInfoSumInterface interface {
|
||||||
// File name
|
// File name
|
||||||
Name() string
|
Name() string
|
||||||
|
|
|
@ -146,7 +146,7 @@ var (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultTHash is default TarSum hashing algoritm - "sha256".
|
// DefaultTHash is default TarSum hashing algorithm - "sha256".
|
||||||
var DefaultTHash = NewTHash("sha256", sha256.New)
|
var DefaultTHash = NewTHash("sha256", sha256.New)
|
||||||
|
|
||||||
type simpleTHash struct {
|
type simpleTHash struct {
|
||||||
|
@ -261,7 +261,7 @@ func (ts *tarSum) Read(buf []byte) (int, error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filling the tar writter
|
// Filling the tar writer
|
||||||
if _, err = ts.tarW.Write(buf2[:n]); err != nil {
|
if _, err = ts.tarW.Write(buf2[:n]); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func GetFdInfo(in interface{}) (uintptr, bool) {
|
||||||
func GetWinsize(fd uintptr) (*Winsize, error) {
|
func GetWinsize(fd uintptr) (*Winsize, error) {
|
||||||
ws := &Winsize{}
|
ws := &Winsize{}
|
||||||
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
|
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
|
||||||
// Skipp errno = 0
|
// Skip errno = 0
|
||||||
if err == 0 {
|
if err == 0 {
|
||||||
return ws, nil
|
return ws, nil
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func GetWinsize(fd uintptr) (*Winsize, error) {
|
||||||
// SetWinsize tries to set the specified window size for the specified file descriptor.
|
// SetWinsize tries to set the specified window size for the specified file descriptor.
|
||||||
func SetWinsize(fd uintptr, ws *Winsize) error {
|
func SetWinsize(fd uintptr, ws *Winsize) error {
|
||||||
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
|
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
|
||||||
// Skipp errno = 0
|
// Skip errno = 0
|
||||||
if err == 0 {
|
if err == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
|
||||||
// we want the number of colons in the T portion of the timestamp
|
// we want the number of colons in the T portion of the timestamp
|
||||||
tcolons := strings.Count(value, ":")
|
tcolons := strings.Count(value, ":")
|
||||||
// if parseInLocation is off and we have a +/- zone offset (not Z) then
|
// if parseInLocation is off and we have a +/- zone offset (not Z) then
|
||||||
// there will be an extra colon in the input for the tz offset subract that
|
// there will be an extra colon in the input for the tz offset subtract that
|
||||||
// colon from the tcolons count
|
// colon from the tcolons count
|
||||||
if !parseInLocation && !strings.ContainsAny(value, "zZ") && tcolons > 0 {
|
if !parseInLocation && !strings.ContainsAny(value, "zZ") && tcolons > 0 {
|
||||||
tcolons--
|
tcolons--
|
||||||
|
|
|
@ -29,8 +29,8 @@ func (vi *VersionInfo) isValid() bool {
|
||||||
//
|
//
|
||||||
// Each VersionInfo will be converted to a string in the format of
|
// Each VersionInfo will be converted to a string in the format of
|
||||||
// "product/version", where the "product" is get from the name field, while
|
// "product/version", where the "product" is get from the name field, while
|
||||||
// version is get from the version field. Several pieces of verson information
|
// version is get from the version field. Several pieces of version information
|
||||||
// will be concatinated and separated by space.
|
// will be concatenated and separated by space.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// AppendVersions("base", VersionInfo{"foo", "1.0"}, VersionInfo{"bar", "2.0"})
|
// AppendVersions("base", VersionInfo{"foo", "1.0"}, VersionInfo{"bar", "2.0"})
|
||||||
|
|
Loading…
Reference in a new issue