On Tue, Jul 19, 2016 at 8:43 AM, roger peppe <rogpe...@gmail.com> wrote: > On 19 July 2016 at 15:18, Ian Lance Taylor <i...@golang.org> wrote: >> On Tue, Jul 19, 2016 at 5:52 AM, roger peppe <rogpe...@gmail.com> wrote: >>> Until not so long ago, if I wanted to (say) insert a log.Printf >>> somewhere in net/http to see what's going on, I could just >>> change the net/http code and "go install net/http". >>> >>> Since Go 1.5, that no longer seems to be the case, for >>> some packages at any rate. Any changes I make in net/http >>> seem to be ignored (interestingly, other packages >>> don't have this issue - net/url for example). >>> >>> Is there a way I can install an individual stdlib package now without >>> rebuilding the whole go stdlib? >> >> That should still work fine and for me it does seem to work fine. Can >> you give us a step-by-step of what you are doing? >> >> I should say that while net/http is not a special case, net/http does >> include a bundled copy of golang.org/x/net/http2. So modifying the >> latter will not affect a program that uses net/http. But it doesn't >> sound like that is what you are doing. > > No, that's not what I'm doing. > Here's a transcript: http://paste.ubuntu.com/20048888/ > (note that I deliberately interrupted the build before the > tests completed). > > The "go install" at the end should fail with a syntax error. > Instead it succeeds, ignoring the corrupted server.go file. > > If this isn't intended behaviour, I'll raise an issue.
It's not the intended behaviour. I tried to follow your recipe, and this is what happened: > echo ')' >> server.go > git status # On branch master # Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded. # (use "git pull" to update your local branch) # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: server.go # no changes added to commit (use "git add" and/or "git commit -a") > go install # net/http ./server.go:2730: syntax error: non-declaration statement outside function body Wait: I think I know what this is. I'm using a development version and you are using a quasi-release version. This changes the behaviour of the go tool (see isGoRelease in cmd/go/pkg.go). The difference is that in a development version you can build GOROOT packages as you expect. In a release version, GOROOT packages are considered always up to date, even if you change the source code. This is to avoid timestamp problems with installs. You can see this if you run go list -f '{{.Stale}}:{{.StaleReason}}' I predict that you will see false:standard package in Go release distribution See the long comment on isStale in cmd/go/pkg.go. The fix is to use `go build -a` or re-run make.bash. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.