-
Notifications
You must be signed in to change notification settings - Fork 24
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
judgeVersion panic when GITHUB_TOKEN env is set to an invalid token #138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
Thank you!
But I think that if we have a completed token and get an error from Github, it is better not to return an error, but to unset the GITHUB_TOKEN variable and try to make the request again.
By the way, we need to see what error we get from Github if the token is not filled correctly.
@kevincobain2000 what do you think?
Hmmm. I think we should just get rid of GitHub token completely and obtain the latest version from the raw.githubusercontent too like it is done for ls-remote on the branch:json basically not rely on git tags at all. |
We use tags in two places:
And if for Golang we can use json from a separate branch, then for gobrew I do not yet understand what can be used. And so it's a great idea, we need to think about it in more detail. |
@@ -98,6 +98,7 @@ func TestJudgeVersion(t *testing.T) { | |||
// wantVersion: "1.19.1", | |||
// }, | |||
} | |||
os.Unsetenv("GITHUB_TOKEN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no need to remove this variable in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed because otherwise the test would fail as my environment had the broken token.
Maybe we can keep this and create a new one that exposes the error using a broken token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a separate request in which we get rid of the token
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we close this pull req?
To @juev
Would you please do the merges and make the release by pushing the release tag?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we close this pull req?
To @juev Would you please do the merges and make the release by pushing the release tag?
Thanks
ok
I think we can just create a new branch called I don't think there is an industry standard right now that we can follow, all we need is to get the current version somewhere from the internet, and PS: In |
Hey guys, can I close this one as #140 fixes it in another way? |
I think so, thank you! |
I had an invalid GITHUB_TOKEN set on my account and this caused gobrew.ListRemoteVersions to return an empty list of versions.
Because the list is empty the code on gobrew.judgeVersion generates an panic as can be seen on the image bellow.
This PR contains a fix for the panic error.
Probably it is the same error reported on #135.