-
Notifications
You must be signed in to change notification settings - Fork 28
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
Use shared helper to build http client for log and run #39
Conversation
Thanks for your PR! We should probably split it up into separate PRs, but we can discuss first what needs to be done.
This bit I don’t understand. I use Can you describe in detail what you see that doesn’t work please? |
(Note: I have GOARCH/GOOS/... set via When I use
If I fix that issue (which my PR was first meant to address with the httpClient things), I get hit by the next problem:
(Quite simply, the
|
How can I reproduce this? Which repository are you working with? In which directory are you building? |
For me, this reproduces in any (freshly cloned or not) repo (the below log is with the TLS error fixed, but the same goes for the TLS error).
//EDIT: I should apologize, completely forgot my bug report 101 there to actually provide a repro, whoops. As for versions: Everything is using a git main branch version, compiled locally.
I use macOS, but I am pretty sure the error would also happen on Linux. I'll test this in Docker in a bit. Yes, it happens in a very stock Linux as well (latest
|
Thanks for the steps. Turns out the answer to “how can I reproduce this?” is “by building the gok program from the latest commit” — when I worked on commit c3979e1, apparently I never re-compiled gok, which is why I didn’t notice the issue. I have added an integration test to prevent such problems in the future, and pushed a fix. Could you rebase your pull request please? |
Rebase complete. Tested locally on my Pi and run/logs still works. |
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.
Can you also update the commit message please? This commit no longer fixes building :)
go.mod
Outdated
@@ -3,19 +3,19 @@ module github.com/gokrazy/tools | |||
go 1.18 | |||
|
|||
require ( | |||
github.com/breml/rootcerts v0.2.0 | |||
github.com/breml/rootcerts v0.2.6 |
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.
Are any changes to go.mod and go.sum actually necessary, or could you revert these?
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.
Some of them might be, unless you updated it to use the latest gokrazy/internal (for the hostname() change I PR'd).
Usually I never bother with manually fudging with go.mod
and just run go mod tidy
, which updates and fixes checksums all on its own whenever I have to touch dependencies (especially as it erases old checksums that are no longer necessary preventing the go.sum
inflating to a giant size).
internal/helpers/httpclient.go
Outdated
"github.com/gokrazy/internal/updateflag" | ||
) | ||
|
||
func GetHTTPClient(instance string) (*http.Client, *url.URL, error) { |
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.
Could this function instead live in the github.com/gokrazy/internal/httpclient package, with the rest of the shared httpclient functionality? :)
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.
It can, I was just being lazy and didn't wanna file two PRs :p
internal/helpers/httpclient.go
Outdated
func GetHTTPClient(instance string) (*http.Client, *url.URL, error) { | ||
_, updateHostname := updateflag.GetUpdateTarget(instance) | ||
const configBaseName = "http-password.txt" | ||
pw, err := config.HostnameSpecific(updateHostname).ReadFile(configBaseName) |
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.
nit: just use "http-password.txt" directly (without the constant) for consistency
New PR for the HTTPClient functionality only: gokrazy/internal#14 |
Now merged! Also did a |
PR rebased ontop of main with updated internal repo hash. |
Also this fixes
gok run
building anything at all.Looking at
packer.Build
in its current version, it just isn't suited to "build current directory" it seems. Or at least I could not find any way to get it to build local packages (such as.
or./package
) no matter what I tried to pass to it from thegok run
code. (I fully expect this to not just get merged as I put it, but rather invite a discussion on the correct way to fixgok run
)