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

cmd: use CI_API_V4_URL env as gitlab API URL #565

Merged
merged 3 commits into from
May 8, 2020
Merged

cmd: use CI_API_V4_URL env as gitlab API URL #565

merged 3 commits into from
May 8, 2020

Conversation

roobre
Copy link
Contributor

@roobre roobre commented May 7, 2020

This should be a simple change, although it has not been extensively tested.

Closes #563.

baseURL := os.Getenv("GITLAB_API")
if baseURL == "" {
gitlabApi := os.Getenv("GITLAB_API")
gitlabV4Url := os.Getenv("CI_API_V4_URL")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gitlabV4URL.

Also, please fix the above golint error as well.

var gitlabApi should be gitlabAPI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

gitlabV4Url := os.Getenv("CI_API_V4_URL")

var baseURL string
switch true {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use if-else clause? It's interesting, but simple if-else should be better.

Alternatively, you can create another function which returns URL string and use early return.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about the function first, but then it seemed weird to me to have the current gitlabBaseURL to just be a wrapper for url.Parse. I have switched to the if-else chain.

@haya14busa
Copy link
Member

Also, can you update Unreleased section in the changelog as well? https://github.com/reviewdog/reviewdog/blob/master/CHANGELOG.md

Copy link
Member

@haya14busa haya14busa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@haya14busa haya14busa merged commit de62665 into reviewdog:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make use of predefined CI_API_V4_URL instead of GITLAB_API
2 participants