Skip to content

Commit

Permalink
chore: regen (#636)
Browse files Browse the repository at this point in the history
* chore: regen

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>

* chore: remove bearer

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>

* fix: remove usage of io/ioutil

Signed-off-by: ismael FALL <ismael.fall@epitech.eu>

* fix: version of golangci

Signed-off-by: ismael FALL <ismael.fall@epitech.eu>

* fix: gci file

Signed-off-by: ismael FALL <ismael.fall@epitech.eu>

* fix: go version CI

Signed-off-by: ismael FALL <ismael.fall@epitech.eu>

* fix: remove deprecated rule

Signed-off-by: ismael FALL <ismael.fall@epitech.eu>

* chore: go1.20 when possible

---------

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: ismael FALL <ismael.fall@epitech.eu>
Co-authored-by: ismael FALL <ismael.fall@epitech.eu>
Co-authored-by: Isma <71719097+Doozers@users.noreply.github.com>
  • Loading branch information
3 people committed Mar 21, 2023
1 parent fa5443c commit 869435e
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 74 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Expand Up @@ -29,7 +29,7 @@ jobs:
goreleaser-dryrun:
strategy:
matrix:
golang: [1.18.x]
golang: [1.20.x]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
steps:
- uses: actions/checkout@v3.0.2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
uses: golangci/golangci-lint-action@v3.4.0
with:
version: ${{ matrix.golangci_lint }}
#github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -71,7 +71,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
golang: [1.18.x]
golang: [1.20.x]
steps:
- uses: actions/checkout@v3.0.2
- name: Install Go
Expand All @@ -86,7 +86,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
golang: [1.18.x]
golang: [1.20.x]
env:
OS: macos-latest
GOLANG: ${{ matrix.golang }}
Expand Down Expand Up @@ -125,8 +125,8 @@ jobs:
strategy:
matrix:
golang:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
env:
OS: ubuntu-latest
GOLANG: ${{ matrix.golang }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Expand Up @@ -38,5 +38,3 @@ jobs:
# github_token: ${{ github.token }}
# reporter: github-pr-review
# locale: "US"
- name: alexjs
uses: theashraf/alex-action@master
35 changes: 18 additions & 17 deletions cmd/depviz/depaware.txt

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions cmd/depviz/main.go
Expand Up @@ -11,7 +11,6 @@ import (
"os/signal"
"time"

bearer "github.com/Bearer/bearer-go"
"github.com/cayleygraph/cayley"
"github.com/cayleygraph/cayley/graph"
_ "github.com/cayleygraph/cayley/graph/kv/bolt"
Expand All @@ -33,11 +32,10 @@ var (
logger *zap.Logger
schemaConfig *schema.Config

globalFlags = flag.NewFlagSet("depviz", flag.ExitOnError)
globalStorePath = globalFlags.String("store-path", os.Getenv("HOME")+"/.depviz", "store path")
globalDebug = globalFlags.Bool("debug", false, "debug mode")
globalWithStacktrace = globalFlags.Bool("with-stacktrace", false, "show stacktrace on warns, errors and worse")
globalBearerSecretKey = globalFlags.String("bearer-secretkey", "", "optional bearer.sh secret key")
globalFlags = flag.NewFlagSet("depviz", flag.ExitOnError)
globalStorePath = globalFlags.String("store-path", os.Getenv("HOME")+"/.depviz", "store path")
globalDebug = globalFlags.Bool("debug", false, "debug mode")
globalWithStacktrace = globalFlags.Bool("with-stacktrace", false, "show stacktrace on warns, errors and worse")

airtableFlags = flag.NewFlagSet("airtable", flag.ExitOnError)
airtableToken = airtableFlags.String("token", "", "airtable token")
Expand Down Expand Up @@ -145,10 +143,6 @@ func Main(args []string) error {
func globalPreRun() error {
rand.Seed(srand.MustSecure())

if *globalBearerSecretKey != "" {
bearer.ReplaceGlobals(bearer.Init(*globalBearerSecretKey))
}

config := zapconfig.Configurator{}
if *globalDebug {
config.SetLevel(zap.DebugLevel)
Expand Down
2 changes: 1 addition & 1 deletion gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions internal/dvcore/run_test.go
Expand Up @@ -2,7 +2,6 @@ package dvcore

import (
"bytes"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -82,11 +81,11 @@ func TestPullAndSave(t *testing.T) {
gp := dvstore.TestingGoldenDumpPath(t, test.name)
if testutil.UpdateGolden() {
t.Logf("update golden file: %s", gp)
err := ioutil.WriteFile(gp, b.Bytes(), 0644)
err := os.WriteFile(gp, b.Bytes(), 0644)
assert.NoError(t, err, test.name)
}

g, err := ioutil.ReadFile(gp)
g, err := os.ReadFile(gp)
assert.NoError(t, err, test.name)
assert.Equal(t, string(g), b.String())
}
Expand Down
3 changes: 2 additions & 1 deletion internal/dvmodel/dvmodel.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/dvserver/api.go
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"io"
"net/http"

"go.uber.org/zap"
Expand All @@ -24,7 +24,7 @@ func gitHubOAuth(opts Opts, httpLogger *zap.Logger) http.HandlerFunc {
return
}

code, err := ioutil.ReadAll(r.Body)
code, err := io.ReadAll(r.Body)
if err != nil {
httpLogger.Error("get body", zap.Error(err))
http.Error(w, "failed to retrieve body", http.StatusInternalServerError)
Expand Down Expand Up @@ -63,7 +63,7 @@ func gitHubOAuth(opts Opts, httpLogger *zap.Logger) http.HandlerFunc {

defer gitHubResponse.Body.Close()

token, err := ioutil.ReadAll(gitHubResponse.Body)
token, err := io.ReadAll(gitHubResponse.Body)
if err != nil {
httpLogger.Error("get body", zap.Error(err))
http.Error(w, "internal server error", http.StatusInternalServerError)
Expand Down
3 changes: 2 additions & 1 deletion internal/dvserver/server.go
Expand Up @@ -25,6 +25,7 @@ import (
chilogger "github.com/treastech/logger"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"moul.io/depviz/v3/internal/dvcore"
"moul.io/depviz/v3/pkg/chiutil"
"moul.io/multipmuri"
Expand Down Expand Up @@ -184,7 +185,7 @@ func New(ctx context.Context, h *cayley.Handle, schema *schema.Config, opts Opts
}
}),
)
grpcOpts := []grpc.DialOption{grpc.WithInsecure()}
grpcOpts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
if err := RegisterDepvizServiceHandlerFromEndpoint(ctx, gwmux, svc.grpcListenerAddr, grpcOpts); err != nil {
return nil, fmt.Errorf("register service on gateway: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/dvstore/query_test.go
Expand Up @@ -2,7 +2,7 @@ package dvstore

import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

Expand Down Expand Up @@ -62,7 +62,7 @@ func TestLoadTasks(t *testing.T) {

if testutil.UpdateGolden() {
t.Logf("update golden file: %s", gp)
err := ioutil.WriteFile(gp, []byte(actual), 0644)
err := os.WriteFile(gp, []byte(actual), 0644)
assert.NoError(t, err, name)
}

Expand All @@ -82,7 +82,7 @@ func TestLoadTasks(t *testing.T) {
}
}

g, err := ioutil.ReadFile(gp)
g, err := os.ReadFile(gp)
assert.NoError(t, err, name)
assert.Equal(t, len(string(g)), len(actual), gp)
})
Expand Down
10 changes: 1 addition & 9 deletions internal/dvstore/testing.go
@@ -1,34 +1,26 @@
package dvstore

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"

"github.com/cayleygraph/cayley"
"github.com/cayleygraph/cayley/graph"

// required by cayley
_ "github.com/cayleygraph/cayley/graph/kv/bolt"
"github.com/cayleygraph/quad"

// required by cayley
_ "github.com/cayleygraph/quad/gml"

// required by cayley
_ "github.com/cayleygraph/quad/graphml"

// required by cayley
_ "github.com/cayleygraph/quad/json"

// required by cayley
_ "github.com/cayleygraph/quad/jsonld"

// required by cayley
_ "github.com/cayleygraph/quad/nquads"

// required by cayley
_ "github.com/cayleygraph/quad/pquads"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -78,7 +70,7 @@ func TestingGoldenStore(t *testing.T, name string) (*cayley.Handle, func()) {
func TestingStore(t *testing.T) (*cayley.Handle, func()) {
t.Helper()

dir, err := ioutil.TempDir("", "depviz")
dir, err := os.MkdirTemp("", "depviz")
require.NoError(t, err)

err = graph.InitQuadStore("bolt", dir, nil)
Expand Down
12 changes: 2 additions & 10 deletions internal/gomodhack/hack.go
Expand Up @@ -6,28 +6,20 @@
package gomodhack

import (

// required by packr.
_ "github.com/gobuffalo/packr/v2/packr2"
// required by protoc.
_ "github.com/gogo/protobuf/gogoproto"

// required by protoc.
_ "github.com/gogo/protobuf/types"

// nolint:staticcheck
_ "github.com/golang/protobuf/proto"

// required by protoc.
_ "github.com/golang/protobuf/ptypes/timestamp"

// required by protoc.
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"

// required by depaware.
_ "github.com/tailscale/depaware/depaware"

// required by goimports.
_ "golang.org/x/tools/cover"

// required by packr.
_ "github.com/gobuffalo/packr/v2/packr2"
)
2 changes: 0 additions & 2 deletions tool/internal/tools/tools.go
Expand Up @@ -4,10 +4,8 @@
package tools

import (

// required by depaware
_ "github.com/tailscale/depaware/depaware"

// required by goimports
_ "golang.org/x/tools/cover"
)

0 comments on commit 869435e

Please sign in to comment.