run gofumpt
This commit is contained in:
parent
067ca5bb60
commit
3a738e44d6
|
@ -26,7 +26,7 @@ type Metadata struct {
|
||||||
var _ environment.ProcessEnvironment = (*Environment)(nil)
|
var _ environment.ProcessEnvironment = (*Environment)(nil)
|
||||||
|
|
||||||
type Environment struct {
|
type Environment struct {
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
|
|
||||||
// The public identifier for this environment. In this case it is the Docker container
|
// The public identifier for this environment. In this case it is the Docker container
|
||||||
// name that will be used for all instances created under it.
|
// name that will be used for all instances created under it.
|
||||||
|
|
|
@ -218,7 +218,7 @@ func (e *Environment) WaitForStop(ctx context.Context, duration time.Duration, t
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
doTermination := func (s string) error {
|
doTermination := func(s string) error {
|
||||||
e.log().WithField("step", s).WithField("duration", duration).Warn("container stop did not complete in time, terminating process...")
|
e.log().WithField("step", s).WithField("duration", duration).Warn("container stop did not complete in time, terminating process...")
|
||||||
return e.Terminate(ctx, os.Kill)
|
return e.Terminate(ctx, os.Kill)
|
||||||
}
|
}
|
||||||
|
|
1
go.mod
1
go.mod
|
@ -34,7 +34,6 @@ require (
|
||||||
github.com/mholt/archiver/v3 v3.5.0
|
github.com/mholt/archiver/v3 v3.5.0
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
github.com/pkg/profile v1.6.0
|
|
||||||
github.com/pkg/sftp v1.13.2
|
github.com/pkg/sftp v1.13.2
|
||||||
github.com/sabhiram/go-gitignore v0.0.0-20201211210132-54b8a0bf510f
|
github.com/sabhiram/go-gitignore v0.0.0-20201211210132-54b8a0bf510f
|
||||||
github.com/spf13/cobra v1.2.1
|
github.com/spf13/cobra v1.2.1
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -704,8 +704,6 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/profile v1.6.0 h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=
|
|
||||||
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
|
|
||||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||||
github.com/pkg/sftp v1.13.2 h1:taJnKntsWgU+qae21Rx52lIwndAdKrj0mfUNQsz1z4Q=
|
github.com/pkg/sftp v1.13.2 h1:taJnKntsWgU+qae21Rx52lIwndAdKrj0mfUNQsz1z4Q=
|
||||||
github.com/pkg/sftp v1.13.2/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
|
github.com/pkg/sftp v1.13.2/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
|
||||||
|
|
|
@ -13,8 +13,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"emperror.dev/errors"
|
"emperror.dev/errors"
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/pterodactyl/wings/server"
|
"github.com/pterodactyl/wings/server"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package router
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
"github.com/pterodactyl/wings/config"
|
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -14,6 +13,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pterodactyl/wings/config"
|
||||||
|
|
||||||
"emperror.dev/errors"
|
"emperror.dev/errors"
|
||||||
"github.com/apex/log"
|
"github.com/apex/log"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
ws "github.com/gorilla/websocket"
|
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
|
ws "github.com/gorilla/websocket"
|
||||||
|
|
||||||
"github.com/pterodactyl/wings/router/middleware"
|
"github.com/pterodactyl/wings/router/middleware"
|
||||||
"github.com/pterodactyl/wings/router/websocket"
|
"github.com/pterodactyl/wings/router/websocket"
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestName(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
g.It("calls strike once per time period", func() {
|
g.It("calls strike once per time period", func() {
|
||||||
t := newConsoleThrottle(1, time.Millisecond * 20)
|
t := newConsoleThrottle(1, time.Millisecond*20)
|
||||||
|
|
||||||
var times int
|
var times int
|
||||||
t.strike = func() {
|
t.strike = func() {
|
||||||
|
@ -53,10 +53,10 @@ func TestName(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkConsoleThrottle(b *testing.B) {
|
func BenchmarkConsoleThrottle(b *testing.B) {
|
||||||
t := newConsoleThrottle(10, time.Millisecond * 10)
|
t := newConsoleThrottle(10, time.Millisecond*10)
|
||||||
|
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
t.Allow()
|
t.Allow()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,7 +42,6 @@ func (l *Locker) Acquire() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TryAcquire will attempt to acquire a power-lock until the context provided
|
// TryAcquire will attempt to acquire a power-lock until the context provided
|
||||||
// is canceled.
|
// is canceled.
|
||||||
func (l *Locker) TryAcquire(ctx context.Context) error {
|
func (l *Locker) TryAcquire(ctx context.Context) error {
|
||||||
|
|
|
@ -95,7 +95,7 @@ func TestPower(t *testing.T) {
|
||||||
|
|
||||||
l.Acquire()
|
l.Acquire()
|
||||||
go func() {
|
go func() {
|
||||||
time.AfterFunc(time.Millisecond * 50, func() {
|
time.AfterFunc(time.Millisecond*50, func() {
|
||||||
l.Release()
|
l.Release()
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (r *Rate) Try() bool {
|
||||||
// Reset resets the internal state of the rate limiter back to zero.
|
// Reset resets the internal state of the rate limiter back to zero.
|
||||||
func (r *Rate) Reset() {
|
func (r *Rate) Reset() {
|
||||||
r.mu.Lock()
|
r.mu.Lock()
|
||||||
r.count = 0
|
r.count = 0
|
||||||
r.last = time.Now()
|
r.last = time.Now()
|
||||||
r.mu.Unlock()
|
r.mu.Unlock()
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@ func TestRate(t *testing.T) {
|
||||||
g.It("resets back to zero when called", func() {
|
g.It("resets back to zero when called", func() {
|
||||||
r := NewRate(10, time.Second)
|
r := NewRate(10, time.Second)
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
if i % 10 == 0 {
|
if i%10 == 0 {
|
||||||
r.Reset()
|
r.Reset()
|
||||||
}
|
}
|
||||||
g.Assert(r.Try()).IsTrue()
|
g.Assert(r.Try()).IsTrue()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user