mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #14012 from mjtrangoni/fix-megacheck-issues
Fix last megacheck issues
This commit is contained in:
@@ -85,12 +85,13 @@ jobs:
|
||||
- run: 'go get -u github.com/tsenart/deadcode'
|
||||
- run: 'go get -u github.com/jgautheron/goconst/cmd/goconst'
|
||||
- run: 'go get -u github.com/gordonklaus/ineffassign'
|
||||
- run: 'go get -u honnef.co/go/tools/cmd/megacheck'
|
||||
- run: 'go get -u github.com/opennota/check/cmd/structcheck'
|
||||
- run: 'go get -u github.com/mdempsky/unconvert'
|
||||
- run: 'go get -u github.com/opennota/check/cmd/varcheck'
|
||||
- run:
|
||||
name: run linters
|
||||
command: 'gometalinter --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=goconst --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
|
||||
command: 'gometalinter --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=goconst --enable=ineffassign --enable=megacheck --enable=structcheck --enable=unconvert --enable=varcheck ./...'
|
||||
- run:
|
||||
name: run go vet
|
||||
command: 'go vet ./pkg/...'
|
||||
|
||||
@@ -96,16 +96,15 @@ func (e *InfluxDBExecutor) Query(ctx context.Context, dsInfo *models.DataSource,
|
||||
}
|
||||
|
||||
func (e *InfluxDBExecutor) getQuery(dsInfo *models.DataSource, queries []*tsdb.Query, context *tsdb.TsdbQuery) (*Query, error) {
|
||||
for _, v := range queries {
|
||||
|
||||
query, err := e.QueryParser.Parse(v.Model, dsInfo)
|
||||
// The model supports multiple queries, but right now this is only used from
|
||||
// alerting so we only needed to support batch executing 1 query at a time.
|
||||
if len(queries) > 0 {
|
||||
query, err := e.QueryParser.Parse(queries[0].Model, dsInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return query, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("query request contains no queries")
|
||||
}
|
||||
|
||||
|
||||
@@ -3,19 +3,20 @@ package main
|
||||
import "testing"
|
||||
|
||||
func TestPreparingReleaseFromRemote(t *testing.T) {
|
||||
|
||||
var builder releaseBuilder
|
||||
|
||||
versionIn := "v5.2.0-beta1"
|
||||
expectedVersion := "5.2.0-beta1"
|
||||
whatsNewUrl := "https://whatsnews.foo/"
|
||||
relNotesUrl := "https://relnotes.foo/"
|
||||
expectedArch := "amd64"
|
||||
expectedOs := "linux"
|
||||
buildArtifacts := []buildArtifact{{expectedOs,expectedArch, ".linux-amd64.tar.gz"}}
|
||||
|
||||
var builder releaseBuilder
|
||||
buildArtifacts := []buildArtifact{{expectedOs, expectedArch, ".linux-amd64.tar.gz"}}
|
||||
|
||||
builder = releaseFromExternalContent{
|
||||
getter: mockHttpGetter{},
|
||||
rawVersion: versionIn,
|
||||
getter: mockHttpGetter{},
|
||||
rawVersion: versionIn,
|
||||
artifactConfigurations: buildArtifactConfigurations,
|
||||
}
|
||||
|
||||
@@ -50,7 +51,6 @@ func (mockHttpGetter) getContents(url string) (string, error) {
|
||||
return url, nil
|
||||
}
|
||||
|
||||
|
||||
func TestPreparingReleaseFromLocal(t *testing.T) {
|
||||
whatsNewUrl := "https://whatsnews.foo/"
|
||||
relNotesUrl := "https://relnotes.foo/"
|
||||
@@ -60,7 +60,7 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
|
||||
var builder releaseBuilder
|
||||
testDataPath := "testdata"
|
||||
builder = releaseLocalSources{
|
||||
path: testDataPath,
|
||||
path: testDataPath,
|
||||
artifactConfigurations: buildArtifactConfigurations,
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
|
||||
expectedOs := "win"
|
||||
|
||||
builder = releaseLocalSources{
|
||||
path: testDataPath,
|
||||
path: testDataPath,
|
||||
artifactConfigurations: []buildArtifact{{
|
||||
os: expectedOs,
|
||||
arch: expectedArch,
|
||||
|
||||
Reference in New Issue
Block a user