Skip to content

Commit

Permalink
[Build-deps] update dependencies (#3393)
Browse files Browse the repository at this point in the history
* update dependencies

* upgrade redis

* go mod tidy

* remove replace directives

* use go 1.19 for docker images

* fix integration test

* use newer golangci-lint

* fix typo

* compare user fields one by one

* fix some linter issues
  • Loading branch information
wkloucek authored Oct 26, 2022
1 parent e470acc commit d31dcb0
Show file tree
Hide file tree
Showing 93 changed files with 484 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def makeStep(target):
def lintStep():
return {
"name": "lint",
"image": "registry.cern.ch/docker.io/golangci/golangci-lint:v1.42.1",
"image": "registry.cern.ch/docker.io/golangci/golangci-lint:v1.50.1",
"commands": [
"golangci-lint run --timeout 10m0s",
],
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.reva
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

FROM golang:alpine3.13 as builder
FROM golang:1.19-alpine as builder

RUN apk --no-cache add \
ca-certificates \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.revad
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

FROM golang:alpine3.13 as builder
FROM golang:1.19-alpine as builder

RUN apk --no-cache add \
ca-certificates \
Expand All @@ -36,7 +36,7 @@ RUN make build-revad-docker && \

RUN mkdir -p /etc/revad/ && echo "" > /etc/revad/revad.toml

FROM golang:alpine3.13
FROM golang:1.19-alpine

RUN apk --no-cache add \
mailcap
Expand Down
10 changes: 5 additions & 5 deletions cmd/reva/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package main
import (
"bufio"
"encoding/json"
"io/ioutil"
"os"
gouser "os/user"
"path"
"strings"
Expand Down Expand Up @@ -50,7 +50,7 @@ func getConfigFile() string {
}

func readConfig() (*config, error) {
data, err := ioutil.ReadFile(getConfigFile())
data, err := os.ReadFile(getConfigFile())
if err != nil {
return nil, err
}
Expand All @@ -68,7 +68,7 @@ func writeConfig(c *config) error {
if err != nil {
return err
}
return ioutil.WriteFile(getConfigFile(), data, 0600)
return os.WriteFile(getConfigFile(), data, 0600)
}

func getTokenFile() string {
Expand All @@ -81,15 +81,15 @@ func getTokenFile() string {
}

func readToken() (string, error) {
data, err := ioutil.ReadFile(getTokenFile())
data, err := os.ReadFile(getTokenFile())
if err != nil {
return "", err
}
return string(data), nil
}

func writeToken(token string) {
err := ioutil.WriteFile(getTokenFile(), []byte(token), 0600)
err := os.WriteFile(getTokenFile(), []byte(token), 0600)
if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/revad/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ package config

import (
"io"
"io/ioutil"

"github.com/BurntSushi/toml"
"github.com/pkg/errors"
)

// Read reads the configuration from the reader.
func Read(r io.Reader) (map[string]interface{}, error) {
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
err = errors.Wrap(err, "config: error reading from reader")
return nil, err
Expand Down
9 changes: 4 additions & 5 deletions cmd/revad/internal/grace/grace.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package grace

import (
"fmt"
"io/ioutil"
"net"
"os"
"os/signal"
Expand Down Expand Up @@ -108,7 +107,7 @@ func (w *Watcher) clean() error {
}

func (w *Watcher) readPID() (int, error) {
piddata, err := ioutil.ReadFile(w.pidFile)
piddata, err := os.ReadFile(w.pidFile)
if err != nil {
return 0, err
}
Expand All @@ -123,7 +122,7 @@ func (w *Watcher) readPID() (int, error) {
// GetProcessFromFile reads the pidfile and returns the running process or error if the process or file
// are not available.
func GetProcessFromFile(pfile string) (*os.Process, error) {
data, err := ioutil.ReadFile(pfile)
data, err := os.ReadFile(pfile)
if err != nil {
return nil, err
}
Expand All @@ -144,7 +143,7 @@ func GetProcessFromFile(pfile string) (*os.Process, error) {
// WritePID writes the pid to the configured pid file.
func (w *Watcher) WritePID() error {
// Read in the pid file as a slice of bytes.
if piddata, err := ioutil.ReadFile(w.pidFile); err == nil {
if piddata, err := os.ReadFile(w.pidFile); err == nil {
// Convert the file contents to an integer.
if pid, err := strconv.Atoi(string(piddata)); err == nil {
// Look for the pid in the process list.
Expand Down Expand Up @@ -174,7 +173,7 @@ func (w *Watcher) WritePID() error {

// If we get here, then the pidfile didn't exist or we are are in graceful reload and thus we overwrite
// or the pid in it doesn't belong to the user running this app.
err := ioutil.WriteFile(w.pidFile, []byte(fmt.Sprintf("%d", os.Getpid())), 0664)
err := os.WriteFile(w.pidFile, []byte(fmt.Sprintf("%d", os.Getpid())), 0664)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/revad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"regexp"
Expand Down Expand Up @@ -163,7 +162,7 @@ func getConfigs() ([]map[string]interface{}, error) {
}

func getConfigsFromDir(dir string) (confs []string, err error) {
files, err := ioutil.ReadDir(*dirFlag)
files, err := os.ReadDir(*dirFlag)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/revad/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func getHTTPServer(conf interface{}, l *zerolog.Logger, tp trace.TracerProvider)
return s, nil
}

// adjustCPU parses string cpu and sets GOMAXPROCS
// adjustCPU parses string cpu and sets GOMAXPROCS
// according to its value. It accepts either
// a number (e.g. 3) or a percent (e.g. 50%).
// Default is to use all available cores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ See `CreateDir`.

### Potential Problems

There is no exit critera step so all concurrent calls try to create a symlink in step 3 with only one of them
There is no exit critera step so all concurrent calls try to create a symlink in step 3 with only one of them
succeeding (See `Considerations > Creating symlinks`).

### Negative Effects
Expand All @@ -71,7 +71,7 @@ No risk of inconsistency.
### Potential Problems

Several concurrent calls can get past the exit criteria steps 1 and 2. But the first writing operation is always the
actual move of the node on the filesystem which is an atomic filesystem operation. That means that with concurrent
actual move of the node on the filesystem which is an atomic filesystem operation. That means that with concurrent
calls only one can ever succeed.

### Negative Effects
Expand Down Expand Up @@ -167,16 +167,15 @@ package main

import (
"fmt"
"io/ioutil"
"os"
)

func main() {
err := ioutil.WriteFile("file1", []byte(""), 0600)
err := os.WriteFile("file1", []byte(""), 0600)
if err != nil {
os.Exit(1)
}
err = ioutil.WriteFile("file2", []byte(""), 0600)
err = os.WriteFile("file2", []byte(""), 0600)
if err != nil {
os.Exit(1)
}
Expand Down Expand Up @@ -208,16 +207,15 @@ package main

import (
"fmt"
"io/ioutil"
"os"
)

func main() {
err := ioutil.WriteFile("file1", []byte(""), 0600)
err := os.WriteFile("file1", []byte(""), 0600)
if err != nil {
os.Exit(1)
}
err = ioutil.WriteFile("file2", []byte(""), 0600)
err = os.WriteFile("file2", []byte(""), 0600)
if err != nil {
os.Exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"context"
"encoding/json"
"errors"
"io/ioutil"
"os"
"strings"

userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
Expand Down Expand Up @@ -63,7 +63,7 @@ func (m *Manager) Configure(ml map[string]interface{}) error {
return err
}

f, err := ioutil.ReadFile(c.Users)
f, err := os.ReadFile(c.Users)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit d31dcb0

Please sign in to comment.