Skip to content

Commit

Permalink
Update kit version and http client
Browse files Browse the repository at this point in the history
  • Loading branch information
neoxelox committed Apr 5, 2024
1 parent 858acdc commit 5e4e76d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion envs/dev/api.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tmp_dir = "envs/dev/tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "go build -a -tags netgo -ldflags '-w -extldflags \"-static\"' -o ./envs/dev/tmp/api ./cmd/api/*.go"
cmd = "go build -o ./envs/dev/tmp/api ./cmd/api/*.go"
# Binary file yields from `cmd`.
bin = "./envs/dev/tmp/api"
# Customize binary.
Expand Down
2 changes: 1 addition & 1 deletion envs/dev/cli.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tmp_dir = "envs/dev/tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "go build -a -tags netgo -ldflags '-w -extldflags \"-static\"' -o ./envs/dev/tmp/cli ./cmd/cli/*.go"
cmd = "go build -o ./envs/dev/tmp/cli ./cmd/cli/*.go"
# Binary file yields from `cmd`.
bin = "./envs/dev/tmp/cli"
# Customize binary.
Expand Down
2 changes: 1 addition & 1 deletion envs/dev/worker.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tmp_dir = "envs/dev/tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "go build -a -tags netgo -ldflags '-w -extldflags \"-static\"' -o ./envs/dev/tmp/worker ./cmd/worker/*.go"
cmd = "go build -o ./envs/dev/tmp/worker ./cmd/worker/*.go"
# Binary file yields from `cmd`.
bin = "./envs/dev/tmp/worker"
# Customize binary.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/leporo/sqlf v1.4.0
github.com/mkideal/cli v0.2.7
github.com/neoxelox/errors v0.2.0
github.com/neoxelox/kit v0.26.0
github.com/neoxelox/kit v0.29.0
github.com/rs/xid v1.5.0
golang.org/x/text v0.14.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ github.com/neoxelox/errors v0.2.0 h1:AhvCMJAjUBFCP3PgZHbY6SS8Sc9fxx/DiawU5Cd5RxE
github.com/neoxelox/errors v0.2.0/go.mod h1:gCPnC7z8Qwswwz5Usv3WORxvan9Q6WSrDTvzaQyl7oM=
github.com/neoxelox/gilk v0.5.0 h1:Knw/TgSUnwPDIRJbqoTmG98gYsmKojNCJ5WAjALoWFc=
github.com/neoxelox/gilk v0.5.0/go.mod h1:Q+WgmSMKWd5UAaVjLSmGPbVD11AmHFhlo3QrPum0vo0=
github.com/neoxelox/kit v0.26.0 h1:/F1UNoyV6+Eargg7/vyaiLhY1uIfTD/ikKn2eke7i0k=
github.com/neoxelox/kit v0.26.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/neoxelox/kit v0.29.0 h1:DPifgqzkFvej7efogdqUZ9/a6j2dcq51CfwaY6L8K2k=
github.com/neoxelox/kit v0.29.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
11 changes: 7 additions & 4 deletions pkg/example/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package example
import (
"context"
"encoding/json"
"fmt"
"time"

"github.com/neoxelox/errors"
Expand All @@ -30,7 +29,12 @@ type ExampleService struct {

func NewExampleService(observer *kit.Observer, config config.Config) *ExampleService {
client := kit.NewHTTPClient(observer, kit.HTTPClientConfig{
Timeout: EXAMPLE_SERVICE_TIMEOUT,
Timeout: EXAMPLE_SERVICE_TIMEOUT,
BaseURL: util.Pointer(config.ExampleService.BaseURL),
Headers: util.Pointer(map[string]string{
"Content-Type": "application/json",
}),
RaiseForStatus: util.Pointer(true),
AllowedRedirects: util.Pointer(0),
DefaultRetry: util.Pointer(kit.RetryConfig{
Attempts: 3,
Expand Down Expand Up @@ -60,8 +64,7 @@ type ExampleServiceGetCountryResult struct {

func (self *ExampleService) GetCountry(ctx context.Context,
params ExampleServiceGetCountryParams) (*ExampleServiceGetCountryResult, error) {
response, err := self.client.Request(
ctx, "GET", fmt.Sprintf("%s/?name=%s", self.config.ExampleService.BaseURL, params.Name), nil)
response, err := self.client.Request(ctx, "GET", "/?name="+params.Name, nil, nil)
if err != nil {
if kit.ErrHTTPClientTimedOut.Is(err) {
return nil, ErrExampleServiceTimedOut.Raise().Cause(err)
Expand Down

0 comments on commit 5e4e76d

Please sign in to comment.