Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
seborama committed Mar 3, 2019
1 parent 4627395 commit 6b478b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint: deps
@-echo "NOTE: some linters (gotype) require a recent 'go install'"
go get -u github.com/alecthomas/gometalinter
gometalinter --install --update
gometalinter --deadline=300s --disable=dupl --concurrency=2 ./...
gometalinter --deadline=300s --disable=dupl --concurrency=4

goconvey:
@-killall goconvey
Expand Down
8 changes: 5 additions & 3 deletions cassette.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,12 @@ type cassette struct {
removeTLS bool
}

func NewCassette(name string, path string) *cassette {
// newCassette creates a ready to use new cassette.
func newCassette(name string, path string) *cassette {
return &cassette{Name: name, Path: path, trackSliceMutex: &sync.RWMutex{}}
}

// isLongPlay returns true if the cassette content is compressed.
func (k7 *cassette) isLongPlay() bool {
return strings.HasSuffix(k7.Name, ".gz")
}
Expand Down Expand Up @@ -428,7 +430,7 @@ func loadCassette(cassetteName, cassettePath string) (*cassette, error) {

// provide an empty cassette as a minimum
if k7 == nil {
k7 = NewCassette(cassetteName, cassettePath)
k7 = newCassette(cassetteName, cassettePath)
}

// initial stats
Expand All @@ -441,7 +443,7 @@ func loadCassette(cassetteName, cassettePath string) (*cassette, error) {
func readCassetteFromFile(cassetteName, cassettePath string) (*cassette, error) {
filename := cassetteNameToFilename(cassetteName, cassettePath)

k7 := NewCassette(cassetteName, cassettePath)
k7 := newCassette(cassetteName, cassettePath)

data, err := ioutil.ReadFile(filename)
if os.IsNotExist(err) {
Expand Down
8 changes: 4 additions & 4 deletions cassette_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_cassette_gzipFilter(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k7 := NewCassette(tt.fields.Name, tt.fields.Path)
k7 := newCassette(tt.fields.Name, tt.fields.Path)
k7.Tracks = tt.fields.Tracks
k7.tracksLoaded = tt.fields.stats.TracksLoaded

Expand Down Expand Up @@ -110,7 +110,7 @@ func Test_cassette_isLongPlay(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k7 := NewCassette(tt.fields.Name, tt.fields.Path)
k7 := newCassette(tt.fields.Name, tt.fields.Path)
k7.Tracks = tt.fields.Tracks
k7.tracksLoaded = tt.fields.stats.TracksLoaded

Expand Down Expand Up @@ -163,7 +163,7 @@ func Test_cassette_gunzipFilter(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k7 := NewCassette(tt.fields.Name, tt.fields.Path)
k7 := newCassette(tt.fields.Name, tt.fields.Path)
k7.Tracks = tt.fields.Tracks
k7.tracksLoaded = tt.fields.stats.TracksLoaded

Expand Down Expand Up @@ -280,7 +280,7 @@ func Test_cassette_addTrack(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k7 := NewCassette(tt.name, tt.name)
k7 := newCassette(tt.name, tt.name)
k7.removeTLS = tt.fields.removeTLS

k7.addTrack(&tt.args.track)
Expand Down
2 changes: 1 addition & 1 deletion vcr_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Test_vcrTransport_RoundTrip_doesNotChangeLiveReqOrLiveResp(t *testing.T) {
Logger: logger,
CassettePath: "",
},
Cassette: NewCassette("", ""),
Cassette: newCassette("", ""),
}

req, err := http.NewRequest("GET", "https://example.com/path?query", toReadCloser([]byte("Lorem ipsum dolor sit amet")))
Expand Down

0 comments on commit 6b478b0

Please sign in to comment.