1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-03-01 00:35:28 +08:00

add govet check to github action file

This commit is contained in:
dudaodong
2024-02-19 15:50:19 +08:00
parent 7ec2533b7a
commit fdf251ac98
3 changed files with 11 additions and 6 deletions

View File

@@ -20,5 +20,7 @@ jobs:
go-version: "1.18" go-version: "1.18"
- name: Run coverage - name: Run coverage
run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic
- name: Run govet
run: go vet -v ./...
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) run: bash <(curl -s https://codecov.io/bash)

View File

@@ -121,6 +121,9 @@ func convertSlice(src reflect.Value, dst reflect.Value) error {
func convertMap(src reflect.Value, dst reflect.Value) error { func convertMap(src reflect.Value, dst reflect.Value) error {
if src.Kind() != reflect.Map || dst.Kind() != reflect.Struct { if src.Kind() != reflect.Map || dst.Kind() != reflect.Struct {
// if src.Kind() == reflect.Map {
// return convertMap(src, dst)
// } else
if src.Kind() == reflect.Interface { if src.Kind() == reflect.Interface {
return convertMap(src.Elem(), dst) return convertMap(src.Elem(), dst)
} else { } else {

View File

@@ -8,10 +8,10 @@ import (
type ( type (
Person struct { Person struct {
Name string `json:"name"` Name string `json:"name"`
Age int `json:"age"` Age int `json:"age"`
Phone string `json:"phone"` Phone string `json:"phone"`
Addr Address `json:"address"` Address Address `json:"address"`
} }
Address struct { Address struct {
@@ -41,8 +41,8 @@ func TestStructType(t *testing.T) {
assert.Equal(src["name"], p.Name) assert.Equal(src["name"], p.Name)
assert.Equal(src["age"], p.Age) assert.Equal(src["age"], p.Age)
assert.Equal(src["phone"], p.Phone) assert.Equal(src["phone"], p.Phone)
assert.Equal("test", p.Addr.Street) assert.Equal("test", p.Address.Street)
assert.Equal(1, p.Addr.Number) assert.Equal(1, p.Address.Number)
} }
func TestBaseType(t *testing.T) { func TestBaseType(t *testing.T) {