Skip to content

Commit

Permalink
replace literal with const
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Apr 10, 2023
1 parent 937f7c5 commit 0e12e46
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/slack-go/slack"
)

const SlackURL = "https://slack.com"

// Type is the auth type.
//
//go:generate stringer -type Type -linecomment
Expand Down Expand Up @@ -131,5 +133,5 @@ func (s simpleProvider) Test(ctx context.Context) error {
}

func (s simpleProvider) HTTPClient() (*http.Client, error) {
return chttp.New("https://slack.com", s.Cookies())
return chttp.New(SlackURL, s.Cookies())
}
2 changes: 1 addition & 1 deletion cmd/slackdump/internal/diag/rawoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func runRawOutput(ctx context.Context, cmd *base.Command, args []string) error {
}

const (
domain = "https://slack.com"
domain = auth.SlackURL
baseURL = domain + "/api/"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/edge/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Client struct {
}

func New(teamID string, token string, cookies []*http.Cookie) (*Client, error) {
cl, err := chttp.New("https://slack.com", cookies)
cl, err := chttp.New(auth.SlackURL, cookies)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/rusq/chttp"
"github.com/slack-go/slack"

"github.com/rusq/slackdump/v2/auth"
"github.com/rusq/slackdump/v2/internal/cache"
"github.com/rusq/slackdump/v2/internal/chunk"
"github.com/rusq/slackdump/v2/internal/chunk/chunktest"
Expand Down Expand Up @@ -60,7 +61,7 @@ func TestChannelStream(t *testing.T) {
t.Fatal(err)
}

sd := slack.New(prov.SlackToken(), slack.OptionHTTPClient(chttp.Must(chttp.New("https://slack.com", prov.Cookies()))))
sd := slack.New(prov.SlackToken(), slack.OptionHTTPClient(chttp.Must(chttp.New(auth.SlackURL, prov.Cookies()))))

f, err := os.Create("record.jsonl")
if err != nil {
Expand Down

0 comments on commit 0e12e46

Please sign in to comment.