-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove deprecated +build
Go build tags
#888
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"go/build/constraint" | ||
) | ||
|
||
// buildTags is a comma-separated list of build tags. | ||
// | ||
// This follows the pre-Go 1.17 syntax and is kept for compatibility reasons. | ||
type buildTags struct { | ||
Expr constraint.Expr | ||
} | ||
|
||
var _ flag.Value = (*buildTags)(nil) | ||
|
||
func (bt *buildTags) String() string { | ||
if bt.Expr == nil { | ||
return "" | ||
} | ||
|
||
return (bt.Expr).String() | ||
} | ||
|
||
func (bt *buildTags) Set(value string) error { | ||
ct, err := constraint.Parse("// +build " + value) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
bt.Expr = ct | ||
return nil | ||
} | ||
|
||
func andConstraints(x, y constraint.Expr) constraint.Expr { | ||
if x == nil { | ||
return y | ||
} | ||
|
||
if y == nil { | ||
return x | ||
} | ||
|
||
return &constraint.AndExpr{X: x, Y: y} | ||
} | ||
|
||
func orConstraints(x, y constraint.Expr) constraint.Expr { | ||
if x == nil { | ||
return y | ||
} | ||
|
||
if y == nil { | ||
return x | ||
} | ||
|
||
return &constraint.OrExpr{X: x, Y: y} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
package ebpf_test | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build ignore | ||
//go:build ignore | ||
|
||
#include "common.h" | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting!