Bump all dependencies

This commit is contained in:
Matthew Penner
2020-12-27 11:49:08 -07:00
parent ddb683efb6
commit a4c8b8714b
13 changed files with 282 additions and 160 deletions

View File

@@ -49,8 +49,7 @@ func (a *Archive) Create(dst string) error {
// Select a writer based off of the WriteLimit configuration option. If there is no
// write limit, use the file as the writer.
var writer io.Writer = f
writeLimit := int64(config.Get().System.Backups.WriteLimit * 1024 * 1024)
if writeLimit > 0 {
if writeLimit := int64(config.Get().System.Backups.WriteLimit * 1024 * 1024); writeLimit > 0 {
// Token bucket with a capacity of "writeLimit" MiB, adding "writeLimit" MiB/s
// and then wrap the file writer with the token bucket limiter.
writer = ratelimit.Writer(f, ratelimit.NewBucketWithRate(float64(writeLimit), writeLimit))
@@ -199,9 +198,11 @@ func (a *Archive) addToArchive(p string, rp string, w *tar.Writer) error {
return errors.WithMessagef(err, "failed to open '%s' for copying", header.Name)
}
defer f.Close()
// Copy the file's contents to the archive using our buffer.
if _, err := io.CopyBuffer(w, io.LimitReader(f, header.Size), buf); err != nil {
return errors.WithMessagef(err, "failed to copy '%s' to archive", header.Name)
}
return nil
}

View File

@@ -264,7 +264,7 @@ func (fs *Filesystem) Chmod(path string, mode os.FileMode) error {
// looping endlessly.
func (fs *Filesystem) findCopySuffix(dir string, name string, extension string) (string, error) {
var i int
var suffix = " copy"
suffix := " copy"
for i = 0; i < 51; i++ {
if i > 0 {

View File

@@ -456,7 +456,7 @@ func (ip *InstallationProcess) Execute() (string, error) {
}
}()
r, err := ip.client.ContainerCreate(ctx, conf, hostConf, nil, ip.Server.Id()+"_installer")
r, err := ip.client.ContainerCreate(ctx, conf, hostConf, nil, nil, ip.Server.Id()+"_installer")
if err != nil {
return "", err
}

View File

@@ -110,7 +110,7 @@ func (s *Server) Context() context.Context {
// Returns all of the environment variables that should be assigned to a running
// server instance.
func (s *Server) GetEnvironmentVariables() []string {
var out = []string{
out := []string{
fmt.Sprintf("TZ=%s", config.Get().System.Timezone),
fmt.Sprintf("STARTUP=%s", s.Config().Invocation),
fmt.Sprintf("SERVER_MEMORY=%d", s.MemoryLimit()),