Repository: mikefarah/yq
Pull request #859 (2021-06-11 22:19:03)

Add darwin/arm64 builds


Patch:
diff --git a/pkg/yqlib/expression_tokeniser.go b/pkg/yqlib/expression_tokeniser.go
index 0018489b..85e64375 100644
--- a/pkg/yqlib/expression_tokeniser.go
+++ b/pkg/yqlib/expression_tokeniser.go
@@ -320,7 +320,7 @@ func initLexer() (*lex.Lexer, error) {
 	lexer.Add([]byte("( |\t|\n|\r)+"), skip)
 
 	lexer.Add([]byte(`\."[^ "]+"\??`), pathToken(true))
-	lexer.Add([]byte(`\.[^ \}\{\:\[\],\|\.\[\(\)=]+\??`), pathToken(false))
+	lexer.Add([]byte(`\.[^ \}\{\:\[\],\|\.\[\(\)=\n]+\??`), pathToken(false))
 	lexer.Add([]byte(`\.`), selfToken())
 
 	lexer.Add([]byte(`\|`), opToken(pipeOpType))
diff --git a/scripts/xcompile.sh b/scripts/xcompile.sh
index 4c71eacf..449de054 100755
--- a/scripts/xcompile.sh
+++ b/scripts/xcompile.sh
@@ -4,7 +4,7 @@ set -e
 # at https://github.com/inconshreveable/gonative
 
 
-CGO_ENABLED=0 gox -ldflags "${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64"
+CGO_ENABLED=0 gox -ldflags "${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64"
 
 cd build
 rhash -r -a . -o checksums
@@ -21,4 +21,4 @@ rm yq_windows_386.exe.tar.gz
 rm yq_windows_amd64.exe.tar.gz
 
 zip yq_windows_386.zip yq_windows_386.exe
-zip yq_windows_amd64.zip yq_windows_amd64.exe
\ No newline at end of file
+zip yq_windows_amd64.zip yq_windows_amd64.exe


Test patch:
diff --git a/pkg/yqlib/expression_processing_test.go b/pkg/yqlib/expression_processing_test.go
index 2b2f7060..0af22b9f 100644
--- a/pkg/yqlib/expression_processing_test.go
+++ b/pkg/yqlib/expression_processing_test.go
@@ -7,11 +7,24 @@ import (
 	"github.com/mikefarah/yq/v4/test"
 )
 
+var variableWithNewLine = `"cat
+"`
+
 var pathTests = []struct {
 	path            string
 	expectedTokens  []interface{}
 	expectedPostFix []interface{}
 }{
+	{
+		".a\n",
+		append(make([]interface{}, 0), "a"),
+		append(make([]interface{}, 0), "a"),
+	},
+	{
+		variableWithNewLine,
+		append(make([]interface{}, 0), "cat\n (string)"),
+		append(make([]interface{}, 0), "cat\n (string)"),
+	},
 	{
 		`.[0]`,
 		append(make([]interface{}, 0), "SELF", "TRAVERSE_ARRAY", "[", "0 (int64)", "]"),
diff --git a/pkg/yqlib/operator_traverse_path_test.go b/pkg/yqlib/operator_traverse_path_test.go
index 9e230915..59fddde3 100644
--- a/pkg/yqlib/operator_traverse_path_test.go
+++ b/pkg/yqlib/operator_traverse_path_test.go
@@ -35,6 +35,14 @@ var traversePathOperatorScenarios = []expressionScenario{
 			"D0, P[0 0], (!!int)::1\n",
 		},
 	},
+	{
+		skipDoc:    true,
+		document:   `b: cat`,
+		expression: ".b\n",
+		expected: []string{
+			"D0, P[b], (!!str)::cat\n",
+		},
+	},
 	{
 		skipDoc:    true,
 		document:   `[[[1]]]`,