add coverage tests
This commit is contained in:
		
							
								
								
									
										20
									
								
								.github/workflows/go.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/go.yml
									
									
									
									
										vendored
									
									
								
							@@ -17,3 +17,23 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    - name: Unit Tests
 | 
					    - name: Unit Tests
 | 
				
			||||||
      run: go test -v ./...
 | 
					      run: go test -v ./...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  coverage:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      - name: Setup go
 | 
				
			||||||
 | 
					        uses: actions/setup-go@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          go-version: '1.19'
 | 
				
			||||||
 | 
					      - name: Setup
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          go install github.com/mattn/goveralls@latest
 | 
				
			||||||
 | 
					      - name: Test
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          go test -v ./... -parallel=10 -covermode=count -coverprofile=coverage.out
 | 
				
			||||||
 | 
					      - name: Send coverage
 | 
				
			||||||
 | 
					        env:
 | 
				
			||||||
 | 
					          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          goveralls -coverprofile=coverage.out -service=github
 | 
				
			||||||
							
								
								
									
										2
									
								
								core.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								core.go
									
									
									
									
									
								
							@@ -46,8 +46,6 @@ func getDefaultValues(v interface{}) (map[string]string, error) {
 | 
				
			|||||||
	vType := reflect.TypeOf(v).Elem()
 | 
						vType := reflect.TypeOf(v).Elem()
 | 
				
			||||||
	vValue := reflect.ValueOf(v).Elem()
 | 
						vValue := reflect.ValueOf(v).Elem()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//re := regexp.MustCompile(`default:*`)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for i := 0; i < vType.NumField(); i++ {
 | 
						for i := 0; i < vType.NumField(); i++ {
 | 
				
			||||||
		field := vType.Field(i)
 | 
							field := vType.Field(i)
 | 
				
			||||||
		tag := field.Tag.Get("json")
 | 
							tag := field.Tag.Get("json")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user