From 1a9a11a1d1791bb923db17933b2d2880d4c824af Mon Sep 17 00:00:00 2001 From: James Nugent Date: Fri, 28 Jul 2017 14:54:39 -0500 Subject: [PATCH] Trim whitespace around build tags This commit trims whitespace around the build tags specified on the command line in order that invocations such as: easyjson -build_tags linux generate the correct "// +build linux" rather than adding additional whitespace to give "// +build linux". --- easyjson/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/easyjson/main.go b/easyjson/main.go index 1c39497..1cd30bb 100644 --- a/easyjson/main.go +++ b/easyjson/main.go @@ -54,8 +54,13 @@ func generate(fname string) (err error) { outName = *specifiedName } + var trimmedBuildTags string + if *buildTags != "" { + trimmedBuildTags = strings.TrimSpace(*buildTags) + } + g := bootstrap.Generator{ - BuildTags: *buildTags, + BuildTags: trimmedBuildTags, PkgPath: p.PkgPath, PkgName: p.PkgName, Types: p.StructNames,