Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ install:
- go get -u golang.org/x/tools/cmd/gorename
- go get -u github.com/sqs/goreturns
- go get -u github.com/mdempsky/gocode
- go get -u github.com/alecthomas/gometalinter
- go get -u github.com/zmb3/gogetdoc
- go get -u github.com/zmb3/goaddimport
- go get -u github.com/rogpeppe/godef
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ install:
- go get -u golang.org/x/tools/cmd/gorename
- go get -u github.com/sqs/goreturns
- go get -u github.com/mdempsky/gocode
- go get -u github.com/alecthomas/gometalinter
- go get -u github.com/zmb3/gogetdoc
- go get -u github.com/zmb3/goaddimport
- go get -u github.com/rogpeppe/godef
Expand Down
63 changes: 0 additions & 63 deletions lib/lint/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,69 +187,6 @@ type Tool = {
}

const TOOLS: { [string]: Tool } = {
gometalinter: {
prepareArgs(configuredArgs: string[]): string[] {
let args = [...configuredArgs]
if (!args.length) {
args = [
'--vendor',
'--disable-all',
'--enable=vet',
'--enable=vetshadow',
'--enable=golint',
'--enable=ineffassign',
'--enable=goconst',
'--tests',
'--json',
'.'
]
}
if (!args.includes('--json')) {
args.unshift('--json')
}
return args
},
mapMessages(
stdout: string,
editor: TextEditor,
cwd: string
): Array<LinterV2Message> {
let messages = []
try {
messages = JSON.parse(stdout)
} catch (e) {
console.log(e) // eslint-disable-line no-console
}
if (!messages || messages.length < 1) {
return []
}

const results: Array<LinterV2Message> = []

for (const message of messages) {
let range
if (message.col && message.col >= 0) {
range = new Range(
[message.line - 1, message.col - 1],
[message.line - 1, 1000]
)
} else {
range = new Range([message.line - 1, 0], [message.line - 1, 1000])
}
results.push({
linterName: message.linter,
severity: message.severity.toLowerCase(),
location: {
file: path.join(cwd, message.path),
position: range
},
excerpt: message.message + ' (' + message.linter + ')'
})
}

return results
}
},
revive: {
prepareArgs(configuredArgs: string[]): string[] {
let args: string[] = ['--formatter=json']
Expand Down
50 changes: 2 additions & 48 deletions lib/package-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const oldPackages = [
'go-hyperclick',
'navigator-go',
'go-get',
'go-config',
'gometalinter-linter'
'go-config'
]

const bundledPackages = new Map([
Expand All @@ -38,7 +37,6 @@ const goTools = new Map([
['gorename', 'golang.org/x/tools/cmd/gorename'],
['goreturns', 'github.com/sqs/goreturns'],
['gocode', 'github.com/stamblerre/gocode'],
['gometalinter', 'github.com/alecthomas/gometalinter'],
['revive', 'github.com/mgechev/revive'],
['golangci-lint', 'github.com/golangci/golangci-lint/cmd/golangci-lint'],
['gogetdoc', 'github.com/zmb3/gogetdoc'],
Expand Down Expand Up @@ -250,51 +248,7 @@ class PackageManager {
}
for (const [key, value] of goTools) {
const packagePath = value
if (key === 'gometalinter') {
this.subscriptions.add(
this.goget.register(packagePath, async (outcome, packs) => {
if (!packs.includes(packagePath)) {
return
}
const cmd = await this.goconfig.locator.findTool('gometalinter')
if (!cmd) {
return
}
const notification = atom.notifications.addInfo('gometalinter', {
dismissable: true,
icon: 'cloud-download',
description: 'Running `gometalinter --install` to install tools.'
})
const opt = this.goconfig.executor.getOptions('project')
const r = await this.goconfig.executor.exec(cmd, ['--install'], opt)
notification.dismiss()
const stdout =
r.stdout instanceof Buffer ? r.stdout.toString() : r.stdout
const stderr =
r.stderr instanceof Buffer ? r.stderr.toString() : r.stderr
const detail = stdout + os.EOL + stderr

if (r.exitcode !== 0) {
atom.notifications.addWarning('gometalinter', {
dismissable: true,
icon: 'cloud-download',
detail: detail.trim()
})
return r
}
if (stderr && stderr.trim() !== '') {
console.log('go-plus: (stderr) ' + stderr) // eslint-disable-line no-console
}
atom.notifications.addSuccess('gometalinter', {
dismissable: true,
icon: 'cloud-download',
detail: detail.trim(),
description: 'The tools were installed.'
})
return r
})
)
} else if (key === 'gocode') {
if (key === 'gocode') {
this.subscriptions.add(
this.goget.register(packagePath, async (outcome, packs) => {
if (!packs.includes(packagePath)) {
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"goreturns",
"lint",
"vet",
"gometalinter",
"go-debug",
"delve",
"hyperclick",
Expand Down Expand Up @@ -395,11 +394,10 @@
"title": "Linter",
"description": "The linter that is used to lint your code",
"type": "string",
"default": "gometalinter",
"default": "golangci-lint",
"enum": [
"gometalinter",
"revive",
"golangci-lint"
"golangci-lint",
"revive"
],
"order": 1
},
Expand Down