build: remove Build stutter from BuildConstraint*

Address golint failure.
This commit is contained in:
Michael McLoughlin
2019-01-02 21:55:43 -08:00
parent 6202c2c9aa
commit 75224ed031
3 changed files with 10 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ func (c *Context) Package(path string) {
c.pkg = pkg c.pkg = pkg
} }
func (c *Context) BuildConstraints(t buildtags.ConstraintsConvertable) { func (c *Context) Constraints(t buildtags.ConstraintsConvertable) {
cs := t.ToConstraints() cs := t.ToConstraints()
if err := cs.Validate(); err != nil { if err := cs.Validate(); err != nil {
c.AddError(err) c.AddError(err)
@@ -56,17 +56,17 @@ func (c *Context) BuildConstraints(t buildtags.ConstraintsConvertable) {
c.file.Constraints = cs c.file.Constraints = cs
} }
func (c *Context) BuildConstraint(t buildtags.ConstraintConvertable) { func (c *Context) Constraint(t buildtags.ConstraintConvertable) {
c.BuildConstraints(append(c.file.Constraints, t.ToConstraint())) c.Constraints(append(c.file.Constraints, t.ToConstraint()))
} }
func (c *Context) BuildConstraintExpr(expr string) { func (c *Context) ConstraintExpr(expr string) {
constraint, err := buildtags.ParseConstraint(expr) constraint, err := buildtags.ParseConstraint(expr)
if err != nil { if err != nil {
c.AddError(err) c.AddError(err)
return return
} }
c.BuildConstraint(constraint) c.Constraint(constraint)
} }
func (c *Context) Function(name string) { func (c *Context) Function(name string) {

View File

@@ -53,9 +53,9 @@ func Generate() {
} }
} }
func BuildConstraints(t buildtags.ConstraintsConvertable) { ctx.BuildConstraints(t) } func Constraints(t buildtags.ConstraintsConvertable) { ctx.Constraints(t) }
func BuildConstraint(t buildtags.ConstraintConvertable) { ctx.BuildConstraint(t) } func Constraint(t buildtags.ConstraintConvertable) { ctx.Constraint(t) }
func BuildConstraintExpr(expr string) { ctx.BuildConstraintExpr(expr) } func ConstraintExpr(expr string) { ctx.ConstraintExpr(expr) }
func GP8v() reg.GPVirtual { return ctx.GP8v() } func GP8v() reg.GPVirtual { return ctx.GP8v() }
func GP16v() reg.GPVirtual { return ctx.GP16v() } func GP16v() reg.GPVirtual { return ctx.GP16v() }

View File

@@ -70,8 +70,8 @@ func TestTextDecl(t *testing.T) {
func TestConstraints(t *testing.T) { func TestConstraints(t *testing.T) {
ctx := build.NewContext() ctx := build.NewContext()
ctx.BuildConstraintExpr("linux,386 darwin,!cgo") ctx.ConstraintExpr("linux,386 darwin,!cgo")
ctx.BuildConstraintExpr("!noasm") ctx.ConstraintExpr("!noasm")
AssertPrintsLines(t, ctx, printer.NewGoAsm, []string{ AssertPrintsLines(t, ctx, printer.NewGoAsm, []string{
"// Code generated by avo. DO NOT EDIT.", "// Code generated by avo. DO NOT EDIT.",