mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: use golangci-lint as a make command (#17739)
* Build: use golangci-lint as a make command * Since gometalinter was deprecated in favor of golangci-lint so it was replaced by it. Responsibilities held by the gometalinter was moved to golangci-lint * There was some changes in implementation (that was also mentioned in the code comment) between the tools, which uncovered couple errors in the code. Those issues were either solved or disabled by the inline comments * Introduce the golangci-lint config, to make their configuration more manageable * Build: replace backend-lint.sh script with make
This commit is contained in:
@@ -28,6 +28,8 @@ func (assert *Assert) True(value bool, message string) {
|
||||
|
||||
func TestFirst(t *testing.T) {
|
||||
|
||||
anton := "anton"
|
||||
street42 := "Street 42"
|
||||
assert := NewAssert(t)
|
||||
|
||||
testJSON := `{
|
||||
@@ -68,19 +70,19 @@ func TestFirst(t *testing.T) {
|
||||
assert.True(err == nil, "failed to create json from string")
|
||||
|
||||
s, err := j.GetString("name")
|
||||
assert.True(s == "anton" && err == nil, "name should be a string")
|
||||
assert.True(s == anton && err == nil, "name should be a string")
|
||||
|
||||
s = j.MustGetString("name", "fallback")
|
||||
assert.True(s == "anton", "must get string")
|
||||
assert.True(s == anton, "must get string")
|
||||
|
||||
s = j.MustGetString("adsasdas", "fallback")
|
||||
assert.True(s == "fallback", "must get string return fallback")
|
||||
|
||||
s, err = j.GetString("name")
|
||||
assert.True(s == "anton" && err == nil, "name should match")
|
||||
assert.True(s == anton && err == nil, "name should match")
|
||||
|
||||
s, err = j.GetString("address", "street")
|
||||
assert.True(s == "Street 42" && err == nil, "street should match")
|
||||
assert.True(s == street42 && err == nil, "street should match")
|
||||
//log.Println("s: ", s.String())
|
||||
|
||||
_, err = j.GetNumber("age")
|
||||
@@ -109,13 +111,13 @@ func TestFirst(t *testing.T) {
|
||||
//log.Println("address: ", address)
|
||||
|
||||
s, err = address.GetString("street")
|
||||
assert.True(s == "Street 42" && err == nil, "street mismatching")
|
||||
assert.True(s == street42 && err == nil, "street mismatching")
|
||||
|
||||
addressAsString, err := j.GetString("address")
|
||||
assert.True(addressAsString == "" && err != nil, "address should not be an string")
|
||||
|
||||
s, err = j.GetString("address", "street")
|
||||
assert.True(s == "Street 42" && err == nil, "street mismatching")
|
||||
assert.True(s == street42 && err == nil, "street mismatching")
|
||||
|
||||
s, err = j.GetString("address", "name2")
|
||||
assert.True(s == "" && err != nil, "nonexistent string fail")
|
||||
@@ -153,7 +155,7 @@ func TestFirst(t *testing.T) {
|
||||
assert.True(err == nil, "create element fail")
|
||||
|
||||
s, err = element.GetString("street")
|
||||
assert.True(s == "Street 42" && err == nil, "second fail")
|
||||
assert.True(s == street42 && err == nil, "second fail")
|
||||
}
|
||||
|
||||
obj, err := j.GetObject("country")
|
||||
|
||||
Reference in New Issue
Block a user