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

cmd/cover: allow code coverage colour configuration #64954

Open
papadeltasierra opened this issue Jan 4, 2024 · 5 comments · May be fixed by #65056
Open

cmd/cover: allow code coverage colour configuration #64954

papadeltasierra opened this issue Jan 4, 2024 · 5 comments · May be fixed by #65056
Assignees
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@papadeltasierra
Copy link

Go version

go version go1.21.4 linux/amd64

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

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/developer/.cache/go-build'
GOENV='/home/developer/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/developer/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/developer/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/developer/git/nc-registration-hub/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2837408259=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Ref: Issue 27553.
Just running normal go tool cover and viewing output.

What did you expect to see?

I am slightly red/green colour blind and almost always change the default colours of many programs to improve readability (for me - my colleagues might disagree ;-). I never find "grey on black" easy to read and don't really like either the font or the colour scheme for the code coverage.
I read issue 27553 and the comments about CSS being involved but I'm struggling to see how this can easily be changed since it appears to be hard-wired into the output HTML file.

What did you see instead?

It would be nice if the process took a default CSS file that could then be tailored and overridden via a command line parameter so I could use custom colours myself but others can stick with the defaults if they wish.

@seankhliao seankhliao changed the title Allow code coverage colour configuration cmd/cover: allow code coverage colour configuration Jan 4, 2024
@thanm
Copy link
Contributor

thanm commented Jan 4, 2024

Thanks for the report @papadeltasierra . I think the team would be open to such a change; would you like to send a CL?

@thanm thanm self-assigned this Jan 4, 2024
@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 4, 2024
@thanm thanm added this to the Backlog milestone Jan 4, 2024
@papadeltasierra
Copy link
Author

Apologies for the question that is probably obvious to you but what is a CL? I've come across MRs (Merge Requests) or PRs (Pull Requests) in "GitLand" but never a CL. Thanks.

@thanm
Copy link
Contributor

thanm commented Jan 5, 2024

Here "CL" is a Gerrit change list -- that's the code review system we use for the Go project. So yes, "send a CL" is equivalent to "send a pull request".

@papadeltasierra
Copy link
Author

papadeltasierra commented Jan 10, 2024

Is there a sensible place to post ideas on how best to do this? FWIW, my current thoughts are:

  • If given, read the CSS file and do a basic regex based parse to split the selector(s) and declarations
  • Remove spaces from the selectors to ensure no whitespace issues
  • Modify the templating code that that every set of selectors is templated
  • If there is a given CSS file and it contains the selector(s), use the declaration from that else use the existing declarations.
    Any obvious flaws in this?

One thing I haven't gotten clear yet is how to pass the CSS "map" to the templating functions (I'm new to "Go") so if you have any suggestions...

AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jan 11, 2024
Add new flag to supply CSS file for HTML output.

Fixes golang#64954
AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jan 11, 2024
Add new flag to supply CSS file for HTML output.

Fixes golang#64954
@AlexanderYastrebov AlexanderYastrebov linked a pull request Jan 11, 2024 that will close this issue
AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jan 11, 2024
Add new flag to supply CSS file for HTML output.

Fixes golang#64954
@gopherbot
Copy link

Change https://go.dev/cl/555335 mentions this issue: cmd/cover: allow code coverage styling

AlexanderYastrebov added a commit to AlexanderYastrebov/go that referenced this issue Jan 11, 2024
Add a new flag to supply CSS file for HTML output.
Coverage template appends content of this file
to the default styles and thus allows custom styling.

Fixes golang#64954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants