Skip to content

Commit 6908e44

Browse files
authored
Merge pull request #2 from MASNathan/main
Fixed panic on vat.Validate("vat") without countries
2 parents ef1ecc2 + 4de0128 commit 6908e44

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
Build:
55
strategy:
66
matrix:
7-
go-version: [ 1.16.x, 1.17.x ]
7+
go-version: [ 1.16.x, 1.17.x, 1.22.x, 1.23.x ]
88
platform: [ ubuntu-latest, windows-latest ]
99
runs-on: ${{ matrix.platform }}
1010
steps:

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ stored in a database.
1313
## :gear: Installation
1414

1515
Go v1.17.x or newer (RECOMMENDED)
16+
1617
```
1718
go install github.com/ltns35/go-vat
1819
```
1920

2021
Go v1.16.x or older
22+
2123
```
2224
go get -u github.com/ltns35/go-vat
2325
```
@@ -141,8 +143,10 @@ merged.
141143

142144
## :test_tube: Testing
143145

144-
The library is tested against the 2 latest stable major versions of Go.
146+
The library is tested against the 4 latest stable major versions of Go.
145147

148+
- 1.23.x
149+
- 1.22.x
146150
- 1.17.x
147151
- 1.16.x
148152

validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func Validate(vat string, countriesList ...countries.Calculer) (*CheckResult, er
180180

181181
cleanVAT := removeExtraChars(vat)
182182

183-
if countriesList[0] == nil {
183+
if len(countriesList) == 0 {
184184
countriesList = allCountries
185185
}
186186

validator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ func TestCheckVAT(t *testing.T) {
722722

723723
got := new(CheckResult)
724724

725-
if &tt.country == nil {
725+
if tt.country == nil {
726726
got, _ = Validate(value)
727727
} else {
728728
got, _ = Validate(value, tt.country)

0 commit comments

Comments
 (0)