Repository: openconfig/goyang
Pull request #118 (2020-04-28 18:28:49)

Add a GitHub action for running go build and testing.
Migrate testing from travis-ci to github actions.


Patch:
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
new file mode 100644
index 0000000..7cd25bb
--- /dev/null
+++ b/.github/workflows/go.yml
@@ -0,0 +1,60 @@
+name: Go
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  build:
+    name: Build
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go: ['1.12', '1.13', '1.14']
+    steps:
+
+    - name: Set up Go ${{ matrix.go }}
+      uses: actions/setup-go@v2
+      with:
+        go-version: ${{ matrix.go }}
+      id: go
+
+    - name: Check out code into the Go module directory
+      uses: actions/checkout@v2
+
+    - name: Get dependencies
+      run: |
+        go get -v -t -d ./...
+
+    - name: Build
+      run: go build -v ./...
+
+    - name: Test
+      run: go test -v -coverprofile=profile.cov  ./... 
+    
+    - name: Race Test
+      run: go test -race ./...
+
+    - name: Go vet
+      run: go vet ./...
+    
+    - name: Send Coverage
+      uses: shogo82148/actions-goveralls@v1
+      with:
+        path-to-profile: profile.cov
+        parallel: true
+  
+    - name: Check gofmt
+      run: diff -u <(echo -n) <(gofmt -d -s .)
+    
+  finish:
+    needs: build
+    runs-on: ubuntu-latest
+    steps:
+      - uses: shogo82148/actions-goveralls@v1
+        with:
+          parallel-finished: true
+    
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6bb7968..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-language: go
-after_success:
-        - ./scripts/coverage.sh
diff --git a/README.md b/README.md
index 4d22c1e..de303b4 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+![Go](https://github.com/openconfig/goyang/workflows/Go/badge.svg)
+[![Coverage Status](https://coveralls.io/repos/github/openconfig/goyang/badge.svg?branch=master)](https://coveralls.io/github/openconfig/goyang?branch=master)
+
 # goyang
 YANG parser and compiler for Go programs.
 
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..aa57fa1
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,10 @@
+module github.com/openconfig/goyang
+
+go 1.14
+
+require (
+	github.com/google/go-cmp v0.4.0
+	github.com/kylelemons/godebug v1.1.0
+	github.com/openconfig/gnmi v0.0.0-20200414194230-1597cc0f2600
+	github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..428d435
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,71 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/protobuf v3.11.4+incompatible/go.mod h1:lUQ9D1ePzbH2PrIS7ob/bjm9HXyH5WHB0Akwh7URreM=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
+github.com/openconfig/gnmi v0.0.0-20200414194230-1597cc0f2600 h1:EO0ADDEFlykRo0dVFbFglXO16iDoD60IxPJyttU49Ko=
+github.com/openconfig/gnmi v0.0.0-20200414194230-1597cc0f2600/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A=
+github.com/openconfig/goyang v0.0.0-20200115183954-d0a48929f0ea/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU=
+github.com/openconfig/ygot v0.6.0/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs=
+github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 h1:YtFkrqsMEj7YqpIhRteVxJxCeC3jJBieuLr0d4C4rSA=
+github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/pkg/indent/indent.go b/pkg/indent/indent.go
index 78d12e8..a67b888 100644
--- a/pkg/indent/indent.go
+++ b/pkg/indent/indent.go
@@ -42,7 +42,7 @@ func Bytes(indent, b []byte) []byte {
 	if len(lines[len(lines)-1]) == 0 {
 		lines = lines[:len(lines)-1]
 	}
-	return bytes.Join(append([][]byte{[]byte{}}, lines...), indent)
+	return bytes.Join(append([][]byte{{}}, lines...), indent)
 }
 
 // NewWriter returns an io.Writer that prefixes the lines written to it with
@@ -74,7 +74,7 @@ func (w *iw) Write(buf []byte) (int, error) {
 		lines = lines[:len(lines)-1]
 	}
 	if !w.partial {
-		lines = append([][]byte{[]byte{}}, lines...)
+		lines = append([][]byte{{}}, lines...)
 	}
 	joined := bytes.Join(lines, w.prefix)
 	w.partial = joined[len(joined)-1] != '\n'
diff --git a/pkg/yang/types_builtin.go b/pkg/yang/types_builtin.go
index 5e294a1..5ce3245 100644
--- a/pkg/yang/types_builtin.go
+++ b/pkg/yang/types_builtin.go
@@ -371,89 +371,89 @@ func init() {
 }
 
 var baseTypes = map[string]*YangType{
-	"int8": &YangType{
+	"int8": {
 		Name:  "int8",
 		Kind:  Yint8,
 		Range: Int8Range,
 	},
-	"int16": &YangType{
+	"int16": {
 		Name:  "int16",
 		Kind:  Yint16,
 		Range: Int16Range,
 	},
-	"int32": &YangType{
+	"int32": {
 		Name:  "int32",
 		Kind:  Yint32,
 		Range: Int32Range,
 	},
-	"int64": &YangType{
+	"int64": {
 		Name:  "int64",
 		Kind:  Yint64,
 		Range: Int64Range,
 	},
-	"uint8": &YangType{
+	"uint8": {
 		Name:  "uint8",
 		Kind:  Yuint8,
 		Range: Uint8Range,
 	},
-	"uint16": &YangType{
+	"uint16": {
 		Name:  "uint16",
 		Kind:  Yuint16,
 		Range: Uint16Range,
 	},
-	"uint32": &YangType{
+	"uint32": {
 		Name:  "uint32",
 		Kind:  Yuint32,
 		Range: Uint32Range,
 	},
-	"uint64": &YangType{
+	"uint64": {
 		Name:  "uint64",
 		Kind:  Yuint64,
 		Range: Uint64Range,
 	},
 
-	"decimal64": &YangType{
+	"decimal64": {
 		Name:  "decimal64",
 		Kind:  Ydecimal64,
 		Range: Decimal64Range,
 	},
-	"string": &YangType{
+	"string": {
 		Name: "string",
 		Kind: Ystring,
 	},
-	"boolean": &YangType{
+	"boolean": {
 		Name: "boolean",
 		Kind: Ybool,
 	},
-	"enumeration": &YangType{
+	"enumeration": {
 		Name: "enumeration",
 		Kind: Yenum,
 	},
-	"bits": &YangType{
+	"bits": {
 		Name: "bits",
 		Kind: Ybits,
 	},
-	"binary": &YangType{
+	"binary": {
 		Name: "binary",
 		Kind: Ybinary,
 	},
-	"leafref": &YangType{
+	"leafref": {
 		Name: "leafref",
 		Kind: Yleafref,
 	},
-	"identityref": &YangType{
+	"identityref": {
 		Name: "identityref",
 		Kind: Yidentityref,
 	},
-	"empty": &YangType{
+	"empty": {
 		Name: "empty",
 		Kind: Yempty,
 	},
-	"union": &YangType{
+	"union": {
 		Name: "union",
 		Kind: Yunion,
 	},
-	"instance-identifier": &YangType{
+	"instance-identifier": {
 		Name: "instance-identifier",
 		Kind: YinstanceIdentifier,
 	},
diff --git a/scripts/coverage.sh b/scripts/coverage.sh
deleted file mode 100755
index c1655e8..0000000
--- a/scripts/coverage.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-go get github.com/go-playground/overalls && go get github.com/mattn/goveralls
-
-overalls -project=github.com/openconfig/goyang -covermode=count -debug
-goveralls -coverprofile=overalls.coverprofile -service travis-ci
-
-


Test patch:
diff --git a/pkg/yang/ast_test.go b/pkg/yang/ast_test.go
index 5bb270e..f72d44a 100644
--- a/pkg/yang/ast_test.go
+++ b/pkg/yang/ast_test.go
@@ -273,10 +273,10 @@ main_node the_node {
 					Name: "field_value",
 				},
 				Slice: []*Value{
-					&Value{
+					{
 						Name: "sl1",
 					},
-					&Value{
+					{
 						Name: "sl2",
 					},
 				},
@@ -289,7 +289,7 @@ main_node the_node {
 					},
 				},
 				ChildSlice: []*SubNode{
-					&SubNode{
+					{
 						Source: SA("child_slice", "element1",
 							SA("sub_field", "el1")),
 						Name: "element1",
@@ -297,7 +297,7 @@ main_node the_node {
 							Name: "el1",
 						},
 					},
-					&SubNode{
+					{
 						Source: SA("child_slice", "element2",
 							SA("sub_field", "el2")),
 						Name: "element2",
diff --git a/pkg/yang/entry_test.go b/pkg/yang/entry_test.go
index a654a01..766be05 100644
--- a/pkg/yang/entry_test.go
+++ b/pkg/yang/entry_test.go
@@ -2020,7 +2020,7 @@ func TestEntryTypes(t *testing.T) {
 				Kind: CaseEntry,
 				Name: "case1",
 				Dir: map[string]*Entry{
-					"case1-leaf1": &Entry{
+					"case1-leaf1": {
 						Kind: LeafEntry,
 						Name: "Case1Leaf1",
 						Type: &YangType{Kind: Ystring},
@@ -2120,7 +2120,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "anyData-extension",
 							HasArgument: true,
 							Argument:    "anyData-extension-arg",
@@ -2144,7 +2144,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "anyXML-extension",
 							HasArgument: true,
 							Argument:    "anyXML-extension-arg",
@@ -2168,7 +2168,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "container-extension",
 							HasArgument: true,
 							Argument:    "container-extension-arg",
@@ -2192,7 +2192,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "leaf-extension",
 							HasArgument: true,
 							Argument:    "leaf-extension-arg",
@@ -2216,7 +2216,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "leaflist-extension",
 							HasArgument: true,
 							Argument:    "leaflist-extension-arg",
@@ -2240,7 +2240,7 @@ func TestFixChoice(t *testing.T) {
 						statements:  nil,
 					},
 					Extensions: []*Statement{
-						&Statement{
+						{
 							Keyword:     "list-extension",
 							HasArgument: true,
 							Argument:    "list-extension-arg",
@@ -2327,7 +2327,7 @@ func TestDeviation(t *testing.T) {
 		desc:    "deviation with add",
 		inFiles: map[string]string{"deviate": mustReadFile(filepath.Join("testdata", "deviate.yang"))},
 		wants: map[string][]deviationTest{
-			"deviate": []deviationTest{{
+			"deviate": {{
 				path: "/target/add/config",
 				entry: &Entry{
 					Config: TSFalse,
@@ -2406,7 +2406,7 @@ func TestDeviation(t *testing.T) {
 		desc:    "deviation - not supported",
 		inFiles: map[string]string{"deviate": mustReadFile(filepath.Join("testdata", "deviate-notsupported.yang"))},
 		wants: map[string][]deviationTest{
-			"deviate": []deviationTest{{
+			"deviate": {{
 				path: "/target",
 			}, {
 				path: "/target-list",
@@ -2458,7 +2458,7 @@ func TestDeviation(t *testing.T) {
 					}`,
 		},
 		wants: map[string][]deviationTest{
-			"source": []deviationTest{{
+			"source": {{
 				path: "/a",
 			}, {
 				path:  "/b",
@@ -2469,7 +2469,7 @@ func TestDeviation(t *testing.T) {
 		desc:    "deviation with replace",
 		inFiles: map[string]string{"deviate": mustReadFile(filepath.Join("testdata", "deviate-replace.yang"))},
 		wants: map[string][]deviationTest{
-			"deviate": []deviationTest{{
+			"deviate": {{
 				path: "/target/replace/config",
 				entry: &Entry{
 					Config: TSFalse,
@@ -2520,7 +2520,7 @@ func TestDeviation(t *testing.T) {
 		desc:    "deviation with delete",
 		inFiles: map[string]string{"deviate": mustReadFile(filepath.Join("testdata", "deviate-delete.yang"))},
 		wants: map[string][]deviationTest{
-			"deviate": []deviationTest{{
+			"deviate": {{
 				path: "/target/delete/config",
 				entry: &Entry{
 					Config: TSUnset,
@@ -2592,7 +2592,7 @@ func TestDeviation(t *testing.T) {
 			`,
 		},
 		wants: map[string][]deviationTest{
-			"source": []deviationTest{{
+			"source": {{
 				path: "/a",
 				entry: &Entry{
 					Type: &YangType{
@@ -2634,7 +2634,7 @@ func TestDeviation(t *testing.T) {
 			}`,
 		},
 		wants: map[string][]deviationTest{
-			"foo": []deviationTest{{
+			"foo": {{
 				path: "/a/b",
 				entry: &Entry{
 					Type: &YangType{
diff --git a/pkg/yang/identity_test.go b/pkg/yang/identity_test.go
index 27c2994..c0f33f2 100644
--- a/pkg/yang/identity_test.go
+++ b/pkg/yang/identity_test.go
@@ -50,10 +50,10 @@ type identityTestCase struct {
 
 // Test cases for basic identity extraction.
 var basicTestCases = []identityTestCase{
-	identityTestCase{
+	{
 		name: "basic-test-case-1: Check identity is found in module.",
 		in: []inputModule{
-			inputModule{
+			{
 				name: "idtest-one",
 				content: `
 					module idtest-one {
@@ -65,14 +65,14 @@ var basicTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{module: "idtest-one", name: "TEST_ID"},
+			{module: "idtest-one", name: "TEST_ID"},
 		},
 		err: "basic-test-case-1: could not resolve identities",
 	},
-	identityTestCase{
+	{
 		name: "basic-test-case-2: Check identity with base is found in module.",
 		in: []inputModule{
-			inputModule{
+			{
 				name: "idtest-two",
 				content: `
 					module idtest-two {
@@ -88,9 +88,9 @@ var basicTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{module: "idtest-two", name: "TEST_ID"},
-			identityOut{module: "idtest-two", name: "TEST_ID_TWO"},
-			identityOut{module: "idtest-two", name: "TEST_CHILD", baseName: "TEST_ID"},
+			{module: "idtest-two", name: "TEST_ID"},
+			{module: "idtest-two", name: "TEST_ID_TWO"},
+			{module: "idtest-two", name: "TEST_CHILD", baseName: "TEST_ID"},
 		},
 		err: "basic-test-case-2: could not resolve identities",
 	},
@@ -144,10 +144,10 @@ func TestIdentityExtract(t *testing.T) {
 
 // Test cases for validating that identities can be resolved correctly.
 var treeTestCases = []identityTestCase{
-	identityTestCase{
+	{
 		name: "tree-test-case-1: Validate identity resolution across modules",
 		in: []inputModule{
-			inputModule{
+			{
 				name: "base.yang",
 				content: `
 				  module base {
@@ -161,7 +161,7 @@ var treeTestCases = []identityTestCase{
 				    }
 				  }
 				`},
-			inputModule{
+			{
 				name: "remote.yang",
 				content: `
 				  module remote {
@@ -173,22 +173,22 @@ var treeTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{
+			{
 				module: "remote",
 				name:   "REMOTE_BASE",
 				values: []string{"LOCAL_REMOTE_BASE"},
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "LOCAL_REMOTE_BASE",
 				baseName: "r:REMOTE_BASE",
 			},
 		},
 	},
-	identityTestCase{
+	{
 		name: "tree-test-case-2: Multi-level inheritance validation.",
 		in: []inputModule{
-			inputModule{
+			{
 				name: "base.yang",
 				content: `
 				  module base {
@@ -218,7 +218,7 @@ var treeTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{
+			{
 				module: "base",
 				name:   "GREATGRANDFATHER",
 				values: []string{
@@ -230,38 +230,38 @@ var treeTestCases = []identityTestCase{
 					"BROTHER",
 				},
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "GRANDFATHER",
 				baseName: "GREATGRANDFATHER",
 				values:   []string{"FATHER", "UNCLE", "SON", "BROTHER"},
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "GREATUNCLE",
 				baseName: "GREATGRANDFATHER",
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "FATHER",
 				baseName: "GRANDFATHER",
 				values:   []string{"SON", "BROTHER"},
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "UNCLE",
 				baseName: "GRANDFATHER",
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "BROTHER",
 				baseName: "FATHER",
 			},
 		},
 	},
-	identityTestCase{
+	{
 		in: []inputModule{
-			inputModule{
+			{
 				name: "base.yang",
 				content: `
 				  module base {
@@ -282,28 +282,28 @@ var treeTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{
+			{
 				module: "base",
 				name:   "BASE",
 				values: []string{"NOTBASE"},
 			},
-			identityOut{
+			{
 				module:   "base",
 				name:     "NOTBASE",
 				baseName: "BASE",
 			},
 		},
 		idrefs: []idrefOut{
-			idrefOut{
+			{
 				module: "base",
 				name:   "idref",
 				values: []string{"NOTBASE"},
 			},
 		},
 	},
-	identityTestCase{
+	{
 		in: []inputModule{
-			inputModule{
+			{
 				name: "base.yang",
 				content: `
 				  module base4 {
@@ -328,28 +328,28 @@ var treeTestCases = []identityTestCase{
 				`},
 		},
 		identities: []identityOut{
-			identityOut{
+			{
 				module: "base4",
 				name:   "BASE4",
 				values: []string{"CHILD4"},
 			},
-			identityOut{
+			{
 				module:   "base4",
 				name:     "CHILD4",
 				baseName: "BASE4",
 			},
 		},
 		idrefs: []idrefOut{
-			idrefOut{
+			{
 				module: "base4",
 				name:   "tref",
 				values: []string{"CHILD4"},
 			},
 		},
 	},
-	identityTestCase{
+	{
 		in: []inputModule{
-			inputModule{
+			{
 				name: "base.yang",
 				content: `
 					module base5 {
@@ -380,19 +380,19 @@ var treeTestCases = []identityTestCase{
 					}`},
 		},
 		identities: []identityOut{
-			identityOut{
+			{
 				module: "base5",
 				name:   "BASE5A",
 				values: []string{"FIVE_ONE"},
 			},
-			identityOut{
+			{
 				module: "base5",
 				name:   "BASE5B",
 				values: []string{"FIVE_TWO"},
 			},
 		},
 		idrefs: []idrefOut{
-			idrefOut{
+			{
 				module: "base5",
 				name:   "union",
 				values: []string{"FIVE_ONE", "FIVE_TWO"},