aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api/goapi.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/api/goapi.go')
-rw-r--r--src/cmd/api/goapi.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index 5d1cf05e31..8b20d123b1 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -680,7 +680,14 @@ func (w *Walker) emitObj(obj types.Object) {
switch obj := obj.(type) {
case *types.Const:
w.emitf("const %s %s", obj.Name(), w.typeString(obj.Type()))
- w.emitf("const %s = %s", obj.Name(), obj.Val())
+ x := obj.Val()
+ short := x.String()
+ exact := x.ExactString()
+ if short == exact {
+ w.emitf("const %s = %s", obj.Name(), short)
+ } else {
+ w.emitf("const %s = %s // %s", obj.Name(), short, exact)
+ }
case *types.Var:
w.emitf("var %s %s", obj.Name(), w.typeString(obj.Type()))
case *types.TypeName: