Skip to content

Commit

Permalink
linter: enable whitespace
Browse files Browse the repository at this point in the history
Signed-off-by: Mark D Horn <[email protected]>
  • Loading branch information
mdhorn committed Apr 24, 2020
1 parent 21dbcdf commit 5930234
Show file tree
Hide file tree
Showing 46 changed files with 21 additions and 115 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ linters:
- vetshadow
- errcheck
- lll
- whitespace
9 changes: 0 additions & 9 deletions args/args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func serveHTTPDescFile(t *testing.T) (*http.Server, error) {
}

func TestKernelCmdInvalidFile(t *testing.T) {

var testArgs Args
var err error

Expand Down Expand Up @@ -111,7 +110,6 @@ func TestTelemetry(t *testing.T) {
}

func TestKernelCmdDemoTrue(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -149,7 +147,6 @@ func TestKernelCmdDemoTrue(t *testing.T) {
}

func TestKernelCmdDemoFalse(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -186,7 +183,6 @@ func TestKernelCmdDemoFalse(t *testing.T) {
}

func TestKernelCmdConfPresent(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -223,7 +219,6 @@ func TestKernelCmdConfPresent(t *testing.T) {
}

func TestKernelCmdLogPresent(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -265,7 +260,6 @@ func TestKernelCmdLogPresent(t *testing.T) {
}

func TestKernelCmdLogError(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -329,7 +323,6 @@ func TestKernelCmdFileProtocol(t *testing.T) {
}

func TestKernelCmdValidFetch(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -371,7 +364,6 @@ func TestKernelCmdValidFetch(t *testing.T) {
}

func TestKernelCmdConfEmpty(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down Expand Up @@ -568,7 +560,6 @@ func TestCheckAllBooleansFalse(t *testing.T) {
}

func TestKernelAndCommandlineAllArgs(t *testing.T) {

var testArgs Args
var kernelCmd string
var err error
Expand Down
3 changes: 0 additions & 3 deletions clr-installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func main() {

func callFrontEnd(options args.Args, md *model.SystemInstall, installReboot *bool,
rootDir string, errChan chan error, done chan bool) {

var err error
for _, fe := range frontEndImpls {
if !fe.MustRun(&options) {
Expand Down Expand Up @@ -238,7 +237,6 @@ func processSwupdOptions(options args.Args, md *model.SystemInstall) {
if options.AllowInsecureHTTPSet {
md.AllowInsecureHTTP = options.AllowInsecureHTTP
}

}

func processPamSaltOption(options args.Args) error {
Expand Down Expand Up @@ -297,7 +295,6 @@ func processISOSetOption(options args.Args, md *model.SystemInstall) {
}

func processTemplateConfigFileOption(options args.Args, md *model.SystemInstall) error {

if filepath.Ext(options.TemplateConfigFile) == ".yaml" {
md.StorageAlias = append(md.StorageAlias,
&model.StorageAlias{Name: "release", File: "release.img"})
Expand Down
3 changes: 0 additions & 3 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ func Run(writer io.Writer, args ...string) error {
// Stdout and Stderr according to the implementor
// args are the actual command and its arguments
func RunAndProcessOutput(printPrefix string, output Output, args ...string) error {

var exe string
var cmdArgs []string

Expand Down Expand Up @@ -176,10 +175,8 @@ func RunAndProcessOutput(printPrefix string, output Output, args ...string) erro
// start scanning stdout for messages
scannerOut := bufio.NewScanner(stdout)
for scannerOut.Scan() {

// specific processing implementation
output.Process(printPrefix, scannerOut.Text())

}

if err := scannerOut.Err(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/cmd_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const crackLibPath = "/usr/bin/cracklib-check"
// and writing stdoutput to byte buffer
// stringtype is used to inform kind of information we are checking: password or passphrase
func CracklibCheck(texttoinpsect string, stringtype string) (bool, string) {

defaultprefix := "Password"
if stringtype != "" {
defaultprefix = stringtype
Expand Down
2 changes: 0 additions & 2 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ func runInstallHook(vars map[string]string, hook *model.InstallHook) error {
// executed using the target swupd
func contentInstall(rootDir string, version string,
md *model.SystemInstall, options args.Args) (progress.Progress, error) {

var prg progress.Progress

sw := swupd.New(rootDir, options, md)
Expand Down Expand Up @@ -955,7 +954,6 @@ func saveInstallResults(rootDir string, md *model.SystemInstall) error {
if err := log.ArchiveLogFile(logFile); err != nil {
errMsgs = append(errMsgs, "Failed to archive log file")
}

} else {
log.Info("Skipping archiving of Installation results")
}
Expand Down
1 change: 0 additions & 1 deletion gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func (gui *Gui) MustRun(args *args.Args) bool {
} else {
return false
}

}

// Run is part of the Frontend interface implementation and is the gui frontend main entry point
Expand Down
1 change: 0 additions & 1 deletion gui/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func RunNetworkTest(md *model.SystemInstall) (NetTestReturnCode, error) {
}

return NetTestFailure, nil

}

// Desc will push a description box into the view for later marking
Expand Down
1 change: 0 additions & 1 deletion gui/pages/disk_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ func (disk *DiskConfig) runScanLoop() {

// addListStoreMediaRow adds new row to the ListStore widget for the given media
func addListStoreMediaRow(store *gtk.ListStore, installMedia storage.InstallTarget) error {

// Create icon image
mediaType := "drive-harddisk-system"
if installMedia.Removable {
Expand Down
3 changes: 1 addition & 2 deletions gui/pages/hostname.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -83,7 +83,6 @@ func (page *HostnamePage) onChange(entry *gtk.Entry) {
if host != "" && warning != "" {
page.warning.SetLabel(warning)
page.controller.SetButtonState(ButtonConfirm, false)

} else {
page.warning.SetLabel("")
page.controller.SetButtonState(ButtonConfirm, true)
Expand Down
3 changes: 1 addition & 2 deletions gui/pages/install.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -216,7 +216,6 @@ func (page *InstallPage) ResetChanges() {

page.controller.SetButtonState(ButtonQuit, true)
}()

}

// Following methods are for the progress.Client API
Expand Down
3 changes: 1 addition & 2 deletions gui/pages/kernel_options.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -259,7 +259,6 @@ func (page *ConfigKernelPage) StoreChanges() {

// ResetChanges will reset this page to match the model
func (page *ConfigKernelPage) ResetChanges() {

// Reset active row to match the model
kern := page.getKern()
if kern != nil {
Expand Down
1 change: 0 additions & 1 deletion gui/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func (window *Window) CreateHeaderBar() error {
// FitToMonitorSize sets a proper size for the installer if it does
// not fit to the monitor size
func FitToMonitorSize(win *Window, w float32, h float32) error {

screen, err := gdk.ScreenGetDefault()
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions hostname/hostname.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2018 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -27,7 +27,6 @@ const (
// IsValidHostname returns error message or nil if is valid
// https://en.wikipedia.org/wiki/Hostname
func IsValidHostname(hostname string) string {

if !startsWithExp.MatchString(hostname) {
return utils.Locale.Get("Hostname can only start with alphanumeric")
}
Expand Down
7 changes: 1 addition & 6 deletions hostname/hostname_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2018 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand All @@ -18,7 +18,6 @@ func init() {
}

func TestEmptyHostname(t *testing.T) {

var host string
var err string

Expand All @@ -29,7 +28,6 @@ func TestEmptyHostname(t *testing.T) {
}

func TestInvalidHostnames(t *testing.T) {

var host string
var err string

Expand All @@ -45,7 +43,6 @@ func TestInvalidHostnames(t *testing.T) {
}

func TestTooLongHostname(t *testing.T) {

var host string
var err string

Expand All @@ -56,7 +53,6 @@ func TestTooLongHostname(t *testing.T) {
}

func TestGoodHostnames(t *testing.T) {

var host string
var err string

Expand All @@ -82,7 +78,6 @@ func TestGoodHostnames(t *testing.T) {
}

func TestSaveHostname(t *testing.T) {

rootDir, err := ioutil.TempDir("", "testhost-")
if err != nil {
t.Fatalf("Could not make temp dir for testing hostname: %q", err)
Expand Down
3 changes: 1 addition & 2 deletions keyboard/keyboard.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2018 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -118,7 +118,6 @@ func IsValidKeyboard(k *Keymap) bool {

// SetTargetKeyboard creates a keyboard vconsole.conf on the target
func SetTargetKeyboard(rootDir string, keyboard string) error {

targetKeyboardFile := filepath.Join(rootDir, "/etc/vconsole.conf")

filehandle, err := os.OpenFile(targetKeyboardFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
Expand Down
3 changes: 1 addition & 2 deletions language/language.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -223,7 +223,6 @@ func IsValidLanguage(l *Language) bool {

// SetTargetLanguage creates a locale locale.conf on the target
func SetTargetLanguage(rootDir string, language string) error {

targetLocaleFile := filepath.Join(rootDir, "/etc/locale.conf")

filehandle, err := os.OpenFile(targetLocaleFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
Expand Down
1 change: 0 additions & 1 deletion log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ func ArchiveLogFile(archiveFile string) error {

// Jump back to the end of the log file
_, _ = filehandle.Seek(0, 2)

}()

_ = filehandle.Sync()
Expand Down
3 changes: 1 addition & 2 deletions log/log_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -162,7 +162,6 @@ func TestLogLevel(t *testing.T) {
}

func TestGetLogFileNameStr(t *testing.T) {

if GetLogFileName() == "" {
t.Fatalf("GetLogFileName returned an empty string")
}
Expand Down
1 change: 0 additions & 1 deletion model/model_ister.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func JSONtoYAMLConfig(cf string) (*SystemInstall, error) {

// For each partition, set the Size
for _, curr := range ic.PartitionLayouts {

partitions, ok := disks[curr.Disk]
if !ok {
sa := StorageAlias{}
Expand Down
1 change: 0 additions & 1 deletion model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ func TestUser(t *testing.T) {
if len(si.Users) != 0 {
t.Fatal("User list should be empty")
}

}

func TestWriteFile(t *testing.T) {
Expand Down
5 changes: 1 addition & 4 deletions network/network_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2018 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand All @@ -18,7 +18,6 @@ func init() {
}

func TestGoodURL(t *testing.T) {

if err := CheckURL("http://www.google.com"); err != nil {
t.Fatalf("Good HTTP URL failed: %s", err)
}
Expand All @@ -33,7 +32,6 @@ func TestGoodURL(t *testing.T) {
}

func TestBadURL(t *testing.T) {

if err := CheckURL("http://www.google.zonk"); err == nil {
t.Fatalf("Bad HTTP URL passed incorrectly: %s", err)
}
Expand Down Expand Up @@ -343,7 +341,6 @@ func TestCopyNetwork(t *testing.T) {
}

func TestGoodDownload(t *testing.T) {

installDataURLBase = "https://cdn.download.clearlinux.org/releases/%s/clear/config/image/.data/%s"

if msg := DownloadInstallerMessage("Pre", PreInstallConf); msg != "" {
Expand Down
3 changes: 1 addition & 2 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019 Intel Corporation
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only

Expand Down Expand Up @@ -55,7 +55,6 @@ func GetProxyValues() []string {

var value string
for _, prefix := range proxyPrefixes {

if prefix == "https" && httpsProxy != "" {
value = httpsProxy
} else {
Expand Down
Loading

0 comments on commit 5930234

Please sign in to comment.