Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Fix various issues that golint complains about
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Fasching authored and Matthias Fasching committed May 5, 2022
1 parent 24da042 commit 9066e1b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 48 deletions.
10 changes: 5 additions & 5 deletions default_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func Test_DefaultContext_GetSet(t *testing.T) {
r.Equal("Mark", c.Value("name").(string))
}

func Test_DefaultContext_Set_Unconfigured(t *testing.T) {
func Test_DefaultContext_Set_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -162,7 +162,7 @@ func Test_DefaultContext_Value(t *testing.T) {
r.Equal("Mark", c.Value("name").(string))
}

func Test_DefaultContext_Value_Unconfigured(t *testing.T) {
func Test_DefaultContext_Value_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}
r.Nil(c.Value("name"))
Expand Down Expand Up @@ -323,7 +323,7 @@ func Test_DefaultContext_Data(t *testing.T) {
r.EqualValues(map[string]interface{}{}, c.Data())
}

func Test_DefaultContext_Data_Unconfigured(t *testing.T) {
func Test_DefaultContext_Data_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -345,7 +345,7 @@ func Test_DefaultContext_String_EmptyData(t *testing.T) {
r.EqualValues("", c.String())
}

func Test_DefaultContext_String_EmptyData_Unconfigured(t *testing.T) {
func Test_DefaultContext_String_EmptyData_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -372,7 +372,7 @@ func Test_DefaultContext_MarshalJSON_EmptyData(t *testing.T) {
r.EqualValues(`{}`, string(jb))
}

func Test_DefaultContext_MarshalJSON_EmptyData_Unconfigured(t *testing.T) {
func Test_DefaultContext_MarshalJSON_EmptyData_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand Down
2 changes: 1 addition & 1 deletion home.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
could be strage.
*/

// Home is a container for Domains and Groups that independantly serves a
// Home is a container for Domains and Groups that independently serves a
// group of pages with its own Middleware and ErrorHandlers. It is usually
// a multi-homed server domain or group of paths under a certain prefix.
//
Expand Down
3 changes: 0 additions & 3 deletions mail/internal/mail/mime.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.5
// +build go1.5

package mail

import (
Expand Down
25 changes: 0 additions & 25 deletions mail/internal/mail/mime_go14.go

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+build !debug
// +build !debug

package plugins

Expand Down
2 changes: 1 addition & 1 deletion plugins/log_debug.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+build debug
// +build debug

package plugins

Expand Down
8 changes: 4 additions & 4 deletions plugins/plugdeps/plugdeps.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// ErrMissingConfig is if config/buffalo-plugins.toml file is not found. Use plugdeps#On(app) to test if plugdeps are being used
var ErrMissingConfig = fmt.Errorf("could not find a buffalo-plugins config file at %s", ConfigPath(meta.New(".")))

// List all of the plugins the application depeneds on. Will return ErrMissingConfig
// List all of the plugins the application depends on. Will return ErrMissingConfig
// if the app is not using config/buffalo-plugins.toml to manage their plugins.
// Use plugdeps#On(app) to test if plugdeps are being used.
func List(app meta.App) (*Plugins, error) {
Expand Down Expand Up @@ -46,11 +46,11 @@ func List(app meta.App) (*Plugins, error) {

func listLocal(app meta.App) (*Plugins, error) {
plugs := New()
proot := filepath.Join(app.Root, "plugins")
if _, err := os.Stat(proot); err != nil {
pRoot := filepath.Join(app.Root, "plugins")
if _, err := os.Stat(pRoot); err != nil {
return plugs, nil
}
err := filepath.WalkDir(proot, func(path string, d fs.DirEntry, err error) error {
err := filepath.WalkDir(pRoot, func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugdeps/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (plugs *Plugins) Decode(r io.Reader) error {
tp := &tomlPlugins{
Plugins: []Plugin{},
}
if _, err := toml.DecodeReader(r, tp); err != nil {
if _, err := toml.NewDecoder(r).Decode(tp); err != nil {
return err
}
for _, p := range tp.Plugins {
Expand Down
14 changes: 7 additions & 7 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
// timing sensitive. Adjust this timing values if they are failing due to
// timing issue.
const (
WAIT_START = 2
WAIT_RUN = 2
CONSUMER_RUN = 8
waitStart = 2
waitRun = 2
consumerRun = 8
)

// startApp starts given buffalo app and check its exit status.
Expand All @@ -32,7 +32,7 @@ func startApp(app *App, wg *sync.WaitGroup, r *require.Assertions) {
}()
// wait until the server started.
// could be improved with connection test but that's too much...
time.Sleep(WAIT_START * time.Second)
time.Sleep(waitStart * time.Second)
}

func Test_Server_Simple(t *testing.T) {
Expand All @@ -55,7 +55,7 @@ var handlerDone = false

// timeConsumer consumes about 10 minutes for processing its request
func timeConsumer(c Context) error {
for i := 0; i < CONSUMER_RUN; i++ {
for i := 0; i < consumerRun; i++ {
fmt.Println("#")
time.Sleep(1 * time.Second)
}
Expand Down Expand Up @@ -89,7 +89,7 @@ func Test_Server_GracefulShutdownOngoingRequest(t *testing.T) {
firstQuery = true
}()
// make sure the request sent
time.Sleep(WAIT_RUN * time.Second)
time.Sleep(waitRun * time.Second)

app.cancel()
time.Sleep(1 * time.Second) // make sure the server started shutdown.
Expand All @@ -114,7 +114,7 @@ func Test_Server_GracefulShutdownOngoingRequest(t *testing.T) {
var timerDone = false

func timerWorker(args worker.Args) error {
for i := 0; i < CONSUMER_RUN; i++ {
for i := 0; i < consumerRun; i++ {
fmt.Println("%")
time.Sleep(1 * time.Second)
}
Expand Down

0 comments on commit 9066e1b

Please sign in to comment.