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

Access token err msg #1121

Merged
merged 3 commits into from
Nov 15, 2024
Merged

Conversation

pururval
Copy link
Contributor

@pururval pururval commented Nov 3, 2024

This PR fixes two issues-

  1. Improve Access Token Error message of src-cli #716

Improved the error message in login.go to emphasize that the access token is created by going to the webpage and the env vars are updated in the terminal.

  1. Failing to build from source - dependency repo looks to be either private or deleted. #1114

As https://github.com/sourcegraph/sourcegraph was changed to https://github.com/sourcegraph/sourcegraph-public-snapshot
The dependency github.com/sourcegraph/sourcegraph/lib was not found. To fix this, a replace directive was added in the go.mod to update the path of that dependency to the new one.

Test plan

  1. Tested by running go run ./cmd/src login to get the following as the expected result-
❌ Problem: No access token is configured.

🛠  To fix: Create an access token by going to https://sourcegraph.com/user/settings/tokens, then set the following environment variables in your terminal:

   export SRC_ENDPOINT=https://sourcegraph.com
   export SRC_ACCESS_TOKEN=(your access token)

   To verify that it's working, run this command again.

exit status 1
  1. Unit tests
Running tool: /usr/local/go/bin/go test -timeout 30s -run ^TestLogin$ github.com/sourcegraph/src-cli/cmd/src

=== RUN   TestLogin
=== RUN   TestLogin/different_endpoint_in_config_vs._arg
--- PASS: TestLogin/different_endpoint_in_config_vs._arg (0.00s)
=== RUN   TestLogin/no_access_token
--- PASS: TestLogin/no_access_token (0.00s)
=== RUN   TestLogin/warning_when_using_config_file
--- PASS: TestLogin/warning_when_using_config_file (0.00s)
=== RUN   TestLogin/invalid_access_token
--- PASS: TestLogin/invalid_access_token (0.01s)
=== RUN   TestLogin/valid
--- PASS: TestLogin/valid (0.00s)
--- PASS: TestLogin (0.01s)
PASS
ok      github.com/sourcegraph/src-cli/cmd/src  0.066s

@pururval pururval requested a review from a team as a code owner November 3, 2024 15:40
@burmudar
Copy link
Contributor

Thanks @pururval!

@burmudar burmudar merged commit ab6791e into sourcegraph:main Nov 15, 2024
2 checks passed
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.

2 participants