Skip to content

Fix error formatting based on best practices from Code Review Comments #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type API struct {
func extractUser(r *http.Request) (*User, error) {
userHeader, ok := r.Header["X-Username"]
if !ok {
return nil, fmt.Errorf("Missing X-Username header")
return nil, fmt.Errorf("missing X-Username header")
}

return lookupUser(userHeader[0])
Expand Down
2 changes: 1 addition & 1 deletion daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (d *Daemon) Shutdown() {
d.Proxy.Stop()
d.API.Stop()
d.DNS.Stop()
d.Error <- fmt.Errorf("Shutting down privileged daemon")
d.Error <- fmt.Errorf("shutting down privileged daemon")
}

func (d *Daemon) Wait() []error {
Expand Down
4 changes: 2 additions & 2 deletions listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (l *tcpListener) Accept() (net.Conn, error) {
l.SetDeadline(time.Now().Add(time.Second))
select {
case <-l.done:
return nil, fmt.Errorf("Server closed")
return nil, fmt.Errorf("server closed")
default:
}

Expand Down Expand Up @@ -47,7 +47,7 @@ func (s *unixListener) Accept() (net.Conn, error) {
s.SetDeadline(time.Now().Add(time.Second))
select {
case <-s.done:
return nil, fmt.Errorf("Server closed")
return nil, fmt.Errorf("server closed")
default:
}

Expand Down
2 changes: 1 addition & 1 deletion nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ensureNFS(home string) error {

output, err := exec.Command("nfsd", "checkexports").Output()
if err != nil {
return fmt.Errorf("There was a problem updating the /etc/exports file, please resolve the issue and run 'sudo nfsd restart'\n%s", string(output))
return fmt.Errorf("there was a problem updating the /etc/exports file, please resolve the issue and run 'sudo nfsd restart'\n%s", string(output))
}

output, _ = exec.Command("nfsd", "status").Output()
Expand Down
14 changes: 7 additions & 7 deletions vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type VM struct {

func (vm *VM) Start() error {
if vm.Process != nil {
return fmt.Errorf("Virtual machine is already running")
return fmt.Errorf("virtual machine is already running")
}

vm.Process = exec.Command(vm.Bin, vm.Args...)
Expand Down Expand Up @@ -101,7 +101,7 @@ func (vm *VM) waitForBoot() error {

for {
if attempts >= 30 {
return fmt.Errorf("Timed out waiting for virtual machine")
return fmt.Errorf("timed out waiting for virtual machine")
}

time.Sleep(time.Second)
Expand Down Expand Up @@ -146,7 +146,7 @@ func (vm *VM) Route() error {
routeIfaceMatcher := regexp.MustCompile(`(?m)^\s*interface:\s*(\w+)$`)
routeIfaceMatches := routeIfaceMatcher.FindAllStringSubmatch(string(routeBytes), -1)
if routeIfaceMatches == nil {
return fmt.Errorf("Unable to find interface")
return fmt.Errorf("unable to find interface")
}

routeIface := routeIfaceMatches[0][1]
Expand All @@ -159,7 +159,7 @@ func (vm *VM) Route() error {
memberMatcher := regexp.MustCompile(`(?m)^\s*member:\s*(.*) flags.*$`)
memberMatches := memberMatcher.FindAllStringSubmatch(string(memberBytes), -1)
if memberMatches == nil {
return fmt.Errorf("Unable to find interface members")
return fmt.Errorf("unable to find interface members")
}

members := strings.Split(memberMatches[0][1], " ")
Expand Down Expand Up @@ -199,7 +199,7 @@ func (vm *VM) dockerSubnet() (string, error) {
}
}

return "", fmt.Errorf("Unable to find bridge network")
return "", fmt.Errorf("unable to find bridge network")
}

func (vm *VM) findContainer(name string) (string, error) {
Expand All @@ -226,7 +226,7 @@ func (vm *VM) findContainer(name string) (string, error) {
return container.NetworkSettings.IPAddress, nil
}

return "", fmt.Errorf("Unable to find container")
return "", fmt.Errorf("unable to find container")
}

func (vm *VM) Stop() error {
Expand Down Expand Up @@ -261,7 +261,7 @@ func (vm *VM) IP() (string, error) {
attempts := 0
for {
if attempts >= 15 {
value <- result{"", fmt.Errorf("Timed out waiting for IP address")}
value <- result{"", fmt.Errorf("timed out waiting for IP address")}
break
}

Expand Down