Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint issues #3

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 1 addition & 16 deletions prow/rocketchat/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,11 @@ type Client struct {
// If logger is non-nil, log all method calls with it.
logger Logger

tokenGenerator func() []byte
fake bool
fake bool

webhookURL string
}

const (
botName = "prow"
botIconEmoji = ":prow:"
)

// NewClient creates a RocketChat client with an API token.
func NewClient(webhook func() []byte) *Client {
webhookURL := string(webhook())
Expand Down Expand Up @@ -104,14 +98,6 @@ func (sl *Client) log(methodName string, args ...interface{}) {
sl.logger.Debugf("%s(%s)", methodName, strings.Join(as, ", "))
}

func (sl *Client) urlValues() *url.Values {
uv := url.Values{}
uv.Add("username", botName)
uv.Add("icon_emoji", botIconEmoji)
uv.Add("token", string(sl.tokenGenerator()))
return &uv
}

func (sl *Client) postMessage(url string, uv *url.Values) error {
resp, err := http.PostForm(url, *uv)
if err != nil {
Expand Down Expand Up @@ -143,7 +129,6 @@ func (sl *Client) WriteMessage(text, channel string) error {
return nil
}

//var uv = sl.urlValues()
uv := url.Values{}
if channel != "" {
uv.Add("channel", channel)
Expand Down