printer: constraints formatting (#209)
Uses `buildtag.Format` to format constraints in the assembly and stub file printers. This will ensure `// + build` and `//go:build` syntax are used consistent with the current Go version. Updates #183
This commit is contained in:
committed by
GitHub
parent
55d98ccf77
commit
79bee1a316
@@ -4,6 +4,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/mmcloughlin/avo/buildtags"
|
||||
"github.com/mmcloughlin/avo/internal/prnt"
|
||||
"github.com/mmcloughlin/avo/ir"
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
@@ -44,8 +45,12 @@ func (p *goasm) header(f *ir.File) {
|
||||
p.Comment(p.cfg.GeneratedWarning())
|
||||
|
||||
if len(f.Constraints) > 0 {
|
||||
constraints, err := buildtags.Format(f.Constraints)
|
||||
if err != nil {
|
||||
p.AddError(err)
|
||||
}
|
||||
p.NL()
|
||||
p.Printf(f.Constraints.GoString())
|
||||
p.Printf(constraints)
|
||||
}
|
||||
|
||||
if len(f.Includes) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user