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

x/tools/cmd/godoc: boolean logic bug prevents using url flag #30259

Closed
rhysh opened this issue Feb 15, 2019 · 2 comments
Closed

x/tools/cmd/godoc: boolean logic bug prevents using url flag #30259

rhysh opened this issue Feb 15, 2019 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rhysh
Copy link
Contributor

rhysh commented Feb 15, 2019

What version of Go are you using (go version)?

$ go version
go version devel +701f6a27b5 Mon Feb 11 18:18:45 2019 +0000 darwin/amd64

I'm comparing the x/tools repo at release-branch.go1.11 vs release-branch.go1.12.

Does this issue reproduce with the latest release?

Yes, this is broken in master of the x/tools repo.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rhys/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rhys/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/49/zmds5zsn75z1283vtzxyfr5hj7yjq4/T/go-build329945537=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go run golang.org/x/tools/cmd/godoc -url=/pkg/fmt
Missing args.
usage: godoc -http=localhost:6060
  -analysis string
    	comma-separated list of analyses to perform (supported: type, pointer). See http://golang.org/lib/godoc/analysis/help.html
  -goroot string
    	Go root directory (default "/usr/local/go")
  -http string
    	HTTP service address (default "localhost:6060")
  -index
    	enable search index
  -index_files string
    	glob pattern specifying index files; if not empty, the index is read from these files in sorted order
  -index_interval duration
    	interval of indexing; 0 for default (5m), negative to only index once at startup
  -index_throttle float
    	index throttle value; 0.0 = no time allocated, 1.0 = full throttle (default 0.75)
  -links
    	link identifiers to their declarations (default true)
  -maxresults int
    	maximum number of full text search results shown (default 10000)
  -notes string
    	regular expression matching note markers to show (default "BUG")
  -play
    	enable playground
  -templates string
    	load templates/JS/CSS from disk in this directory
  -timestamps
    	show timestamps with directory listings
  -url string
    	print HTML for named URL
  -v	verbose mode
  -write_index
    	write index to a file; the file name must be specified with -index_files
  -zip string
    	zip file providing the file system to serve; disabled if empty
exit status 2

What did you expect to see?

I expected to see HTML similar to what's served by https://golang.org/pkg/fmt/

What did you see instead?

I got an error message indicating that I'd provided invalid arguments (see above).


I have a fix for this, including regression tests. I'll upload it shortly.

@gopherbot gopherbot added this to the Unreleased milestone Feb 15, 2019
@gopherbot
Copy link

Change https://golang.org/cl/162907 mentions this issue: cmd/godoc: fix -url flag, add tests

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 18, 2019
@dmitshur
Copy link
Contributor

This is a regression from CL 153869, where the logic for incorrect usage detection was modified to be friendlier after CLI removal. It wasn't caught because we didn't have a test for the -url flag yet (we will after your CL, thanks for that).

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 18, 2019
@golang golang locked and limited conversation to collaborators Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants