Repository: alecthomas/gometalinter (go)

Issue:
Custom linters have nil PartitionStrategy 
Using the following config produces the following error.
The reason is that [`NewLinter`](https://github.com/alecthomas/gometalinter/blob/master/linters.go#L30) doesn't set the `PartitionStrategy`.

```json
{
  "Linters": { "license": "grep -rL 'Apache License' {path}:^(?P<path>.*?\\.go.*)"},
  "Severity": {"license": "error"},
  "Enable": ["license"]
}
```

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11ef957]

goroutine 1 [running]:
main.(*linterState).Partitions(0xc4201084b0, 0xc4201084b0, 0xc420049dd0, 0xc420096208, 0xc420010240, 0xc4200123e0)
        /go/src/github.com/alecthomas/gometalinter/execute.go:85 +0xb7
main.runLinters(0xc4201a7bc0, 0xc4200bb400, 0x28, 0x28, 0x8, 0x0, 0x0, 0x28, 0x28)
        /go/src/github.com/alecthomas/gometalinter/execute.go:126 +0xad8
main.main()
        /go/src/github.com/alecthomas/gometalinter/main.go:179 +0x39e

```

Pull request description:
Set a default partition strategy for custom linters.
Fixes #332 

Apparently golang doesn't let you compare functions so testing for NotNil was the best I could find.

Patch:
diff --git a/linters.go b/linters.go
index fdb15bc..0002287 100644
--- a/linters.go
+++ b/linters.go
@@ -35,6 +35,9 @@ func NewLinter(config LinterConfig) (*Linter, error) {
 	if err != nil {
 		return nil, err
 	}
+	if config.PartitionStrategy == nil {
+		config.PartitionStrategy = partitionToMaxArgSize
+	}
 	return &Linter{
 		LinterConfig: config,
 		regex:        regex,
@@ -66,6 +69,7 @@ func parseLinterSpec(name string, spec string) *Linter {
 
 	config := defaultLinters[name]
 	config.Command, config.Pattern = parts[0], parts[1]
+	config.Name = name
 
 	linter, err := NewLinter(config)
 	kingpin.FatalIfError(err, "invalid linter %q", name)


Test patch:
diff --git a/linters_test.go b/linters_test.go
new file mode 100644
index 0000000..beb619b
--- /dev/null
+++ b/linters_test.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestNewLinterWithCustomLinter(t *testing.T) {
+	config := LinterConfig{
+		Command: "/usr/bin/custom",
+		Pattern: "path",
+	}
+	linter, err := NewLinter(config)
+	require.NoError(t, err)
+	assert.NotNil(t, linter.LinterConfig.PartitionStrategy)
+}