Skip to content

Commit

Permalink
fix gofmt -s
Browse files Browse the repository at this point in the history
  • Loading branch information
neepooha committed Apr 16, 2024
1 parent 1ceb299 commit ace45ec
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 277 deletions.
24 changes: 0 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ module url_shortener
go 1.22.1

require (
github.com/brianvoe/gofakeit/v6 v6.28.0
github.com/fatih/color v1.16.0
github.com/gavv/httpexpect/v2 v2.16.0
github.com/go-chi/chi v1.5.5
github.com/go-chi/chi/v5 v5.0.12
github.com/go-chi/render v1.0.3
Expand All @@ -24,44 +22,23 @@ require (

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sanity-io/litter v1.5.5 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.52.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
Expand All @@ -72,6 +49,5 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240412170617-26222e5d3d56 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
moul.io/http2curl/v2 v2.3.0 // indirect
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
)
100 changes: 0 additions & 100 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/clients/sso/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *Client) IsAdmin(ctx context.Context, userID uint64, appID int) (bool, e
const op = "grpc.IsAdmin"
resp, err := c.perm.IsAdmin(ctx, &ssov2.IsAdminRequest{
UserId: userID,
AppId: int32(appID),
AppId: int32(appID),
})
if err != nil {
return false, fmt.Errorf("%s: %w", op, err)
Expand All @@ -66,7 +66,7 @@ func (c *Client) IsAdmin(ctx context.Context, userID uint64, appID int) (bool, e

func (c *Client) SetAdmin(ctx context.Context, email string, appID int) (bool, error) {
const op = "grpc.SetAdmin"

resp, err := c.perm.SetAdmin(ctx, &ssov2.SetAdminRequest{
Email: email,
AppId: int32(appID),
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/sqlite/sqilte.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *Storage) GetURL(alias string) (string, error) {
err = stmt.QueryRow(alias).Scan(&resURL)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
return "", fmt.Errorf("%s: %w", op, storage.ErrURLNotFound)
return "", fmt.Errorf("%s: %w", op, storage.ErrURLNotFound)
}
return "", fmt.Errorf("%s: %w", op, err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/transport/handlers/admins/set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func New(log *slog.Logger, permProvider PermissionSetter) http.HandlerFunc {
return
}
ctx := metadata.NewOutgoingContext(r.Context(), metadata.Pairs("Authorization", token))

_, err = permProvider.SetAdmin(ctx, req.Email, req.AppID)
if err != nil {
errExpect := "grpc.SetAdmin: rpc error: code = InvalidArgument desc = invalid credentials"
Expand Down
1 change: 0 additions & 1 deletion internal/transport/middleware/context/getfromcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var (
ErrFailedIsAdminCheck = errors.New("failed to check if user is admin")
)


func APPIDFromContext(ctx context.Context) (int, bool) {
appid, ok := ctx.Value(AppIDKey).(int)
return appid, ok
Expand Down
2 changes: 1 addition & 1 deletion internal/transport/middleware/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ func New(log *slog.Logger) func(next http.Handler) http.Handler {

return http.HandlerFunc(fn)
}
}
}
147 changes: 0 additions & 147 deletions tests/url_shortener_test.go

This file was deleted.

0 comments on commit ace45ec

Please sign in to comment.