refactor: run go fmt ./... (#169)
This commit is contained in:
parent
c81393b31a
commit
163922e001
|
@ -6,9 +6,9 @@ import (
|
|||
"github.com/alecthomas/kingpin"
|
||||
"github.com/apex/log"
|
||||
"github.com/fatih/color"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/cli/root"
|
||||
"github.com/ooni/probe-cli/internal/config"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/output"
|
||||
"github.com/pkg/errors"
|
||||
"gopkg.in/AlecAivazis/survey.v1"
|
||||
|
|
|
@ -3,9 +3,9 @@ package root
|
|||
import (
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/log/handlers/batch"
|
||||
"github.com/ooni/probe-cli/internal/log/handlers/cli"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/utils"
|
||||
"github.com/ooni/probe-cli/internal/version"
|
||||
)
|
||||
|
|
|
@ -6,11 +6,11 @@ import (
|
|||
"github.com/alecthomas/kingpin"
|
||||
"github.com/apex/log"
|
||||
"github.com/fatih/color"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/cli/onboard"
|
||||
"github.com/ooni/probe-cli/internal/cli/root"
|
||||
"github.com/ooni/probe-cli/internal/database"
|
||||
"github.com/ooni/probe-cli/internal/nettests"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
)
|
||||
|
||||
func runNettestGroup(tg string, ctx *ooni.Context, network *database.Network) error {
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/ooni/probe-cli/internal/version"
|
||||
)
|
||||
|
||||
|
||||
func init() {
|
||||
cmd := root.Command("version", "Show version.")
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
|
||||
"github.com/apex/log"
|
||||
"github.com/fatih/color"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/database"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/output"
|
||||
engine "github.com/ooni/probe-engine"
|
||||
"github.com/ooni/probe-engine/model"
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/database"
|
||||
"github.com/ooni/probe-cli/internal/ooni"
|
||||
"github.com/ooni/probe-cli/internal/utils/shutil"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
|
||||
type SameFileError struct {
|
||||
Src string
|
||||
Dst string
|
||||
|
@ -35,7 +34,6 @@ func (e NotADirectoryError) Error() string {
|
|||
return fmt.Sprintf("`%s` is not a directory", e.Src)
|
||||
}
|
||||
|
||||
|
||||
type AlreadyExistsError struct {
|
||||
Dst string
|
||||
}
|
||||
|
@ -44,7 +42,6 @@ func (e AlreadyExistsError) Error() string {
|
|||
return fmt.Sprintf("`%s` already exists", e.Dst)
|
||||
}
|
||||
|
||||
|
||||
func samefile(src string, dst string) bool {
|
||||
srcInfo, _ := os.Stat(src)
|
||||
dstInfo, _ := os.Stat(dst)
|
||||
|
@ -68,13 +65,12 @@ func IsSymlink(fi os.FileInfo) bool {
|
|||
return (fi.Mode() & os.ModeSymlink) == os.ModeSymlink
|
||||
}
|
||||
|
||||
|
||||
// Copy data from src to dst
|
||||
//
|
||||
// If followSymlinks is not set and src is a symbolic link, a
|
||||
// new symlink will be created instead of copying the file it points
|
||||
// to.
|
||||
func CopyFile(src, dst string, followSymlinks bool) (error) {
|
||||
func CopyFile(src, dst string, followSymlinks bool) error {
|
||||
if samefile(src, dst) {
|
||||
return &SameFileError{src, dst}
|
||||
}
|
||||
|
@ -139,7 +135,6 @@ func CopyFile(src, dst string, followSymlinks bool) (error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
// Copy mode bits from src to dst.
|
||||
//
|
||||
// If followSymlinks is false, symlinks aren't followed if and only
|
||||
|
@ -168,7 +163,6 @@ func CopyMode(src, dst string, followSymlinks bool) error {
|
|||
return err
|
||||
}
|
||||
|
||||
|
||||
// Copy data and mode bits ("cp src dst"). Return the file's destination.
|
||||
//
|
||||
// The destination may be a directory.
|
||||
|
@ -178,7 +172,7 @@ func CopyMode(src, dst string, followSymlinks bool) error {
|
|||
//
|
||||
// If source and destination are the same file, a SameFileError will be
|
||||
// rased.
|
||||
func Copy(src, dst string, followSymlinks bool) (string, error){
|
||||
func Copy(src, dst string, followSymlinks bool) (string, error) {
|
||||
dstInfo, err := os.Stat(dst)
|
||||
|
||||
if err == nil && dstInfo.Mode().IsDir() {
|
||||
|
@ -205,8 +199,8 @@ func Copy(src, dst string, followSymlinks bool) (string, error){
|
|||
type CopyTreeOptions struct {
|
||||
Symlinks bool
|
||||
IgnoreDanglingSymlinks bool
|
||||
CopyFunction func (string, string, bool) (string, error)
|
||||
Ignore func (string, []os.FileInfo) []string
|
||||
CopyFunction func(string, string, bool) (string, error)
|
||||
Ignore func(string, []os.FileInfo) []string
|
||||
}
|
||||
|
||||
// Recursively copy a directory tree.
|
||||
|
@ -242,13 +236,12 @@ type CopyTreeOptions struct {
|
|||
// exists) can be used.
|
||||
func CopyTree(src, dst string, options *CopyTreeOptions) error {
|
||||
if options == nil {
|
||||
options = &CopyTreeOptions{Symlinks:false,
|
||||
Ignore:nil,
|
||||
CopyFunction:Copy,
|
||||
IgnoreDanglingSymlinks:false}
|
||||
options = &CopyTreeOptions{Symlinks: false,
|
||||
Ignore: nil,
|
||||
CopyFunction: Copy,
|
||||
IgnoreDanglingSymlinks: false}
|
||||
}
|
||||
|
||||
|
||||
srcFileInfo, err := os.Stat(src)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user