• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-pkgz / enum / 32206331736
100%

Build:
DEFAULT BRANCH: master
Ran 19 Aug 2026 01:51AM UTC
Jobs 1
Files 3
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

19 Aug 2026 01:49AM UTC coverage: 92.095% (-7.2%) from 99.273%
32206331736

push

github

web-flow
Evaluate enum constants with go/constant (#24)

* Evaluate enum constants with go/constant

Previously the generator understood only iota, plain literals and a binary
expression with one of + - * / around iota. Anything else silently produced 0:
shifts, bitwise operators, parentheses, references to other constants, and every
literal that is not plain decimal, since the literal converter scanned with %d
and stopped at the first character it did not understand.

After this change constant expressions are evaluated with go/constant, which
covers the whole integer operator set and keeps values exact, so a uint64 enum
past MaxInt64 keeps its value. A spec without an expression now repeats the
expression of the previous spec, the rule the language itself uses, instead of
replaying a recorded operation. Values that cannot be evaluated, or that do not
fit the underlying type, are reported as errors instead of becoming 0.

* Keep the type of a converted constant, resolve names at package scope

The complement of an unsigned constant depends on the width of its type, so
^perm(0) of a uint8 based enum is 255 and not -1. Values now carry the builtin
type they were converted to, and a conversion reports the values that type
cannot hold, matching what the compiler accepts.

Constants declared inside a function are no longer collected: they are not in
scope for the enum values and a local name would shadow the package level one.
Arithmetic on constants with a fractional literal is evaluated exactly, as the
language does, so 1.5 * 2 is 3 rather than an error, and len of a string
literal is supported.

* Follow the number type of a constant through the expression

A typed operand decides the type of an operation, so x / 2.0 is an integer
division when x is a typed integer, and a value reached through a float keeps
its exact result. A typed float holds its value at the width of its type, both
after a conversion and after each operation. Conversions to float and string
... (continued)

400 of 459 new or added lines in 2 files covered. (87.15%)

2 existing lines in 1 file now uncovered.

734 of 797 relevant lines covered (92.1%)

383.67 hits per line

Uncovered Changes

Lines Coverage ∆ File
57
86.03
internal/generator/constexpr.go
2
98.19
-1.0% internal/generator/generator.go

Coverage Regressions

Lines Coverage ∆ File
2
98.19
-1.0% internal/generator/generator.go
Jobs
ID Job ID Ran Files Coverage
1 32206331736.1 19 Aug 2026 01:51AM UTC 3
92.1
GitHub Action Run
Source Files on build 32206331736
  • Tree
  • List 3
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • f5a48620 on github
  • Prev Build on master (#28463682875)
  • Next Build on master (#32206535618)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc