fmt: align consts
parent
77d41d03f5
commit
71190c27a9
|
@ -179,10 +179,18 @@ fn (f mut Fmt) stmt(node ast.Stmt) {
|
|||
f.write('pub ')
|
||||
}
|
||||
f.writeln('const (')
|
||||
mut max := 0
|
||||
for field in it.fields {
|
||||
if field.name.len > max {
|
||||
max = field.name.len
|
||||
}
|
||||
}
|
||||
f.indent++
|
||||
for i, field in it.fields {
|
||||
name := field.name.after('.')
|
||||
f.write('$name = ')
|
||||
f.write('$name ')
|
||||
f.write(strings.repeat(` `, max - field.name.len))
|
||||
f.write('= ')
|
||||
f.expr(field.expr)
|
||||
f.writeln('')
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const (
|
||||
pi = 3.14
|
||||
pi = 3.14
|
||||
phi = 1.618
|
||||
eulers = 2.7182
|
||||
)
|
||||
|
||||
pub const (
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const (
|
||||
pi=3.14
|
||||
phi=1.618
|
||||
eulers=2.7182
|
||||
)
|
||||
|
||||
pub const (
|
||||
|
|
Loading…
Reference in New Issue