-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ExcludeMethod options with default (#8)
Co-authored-by: Fernandez Ludovic <[email protected]>
- Loading branch information
Showing
18 changed files
with
246 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
linters: | ||
enable: | ||
- recvcheck | ||
|
||
output: | ||
show-stats: true | ||
sort-results: true | ||
sort-order: | ||
- linter | ||
- file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
|
||
"github.com/raeperd/recvcheck" | ||
"golang.org/x/tools/go/analysis/singlechecker" | ||
) | ||
|
||
func main() { | ||
singlechecker.Main(recvcheck.Analyzer) | ||
var noBuiltinExcludeMethod bool | ||
|
||
flag.BoolVar(&noBuiltinExcludeMethod, "no-builtin-exclude-method", false, | ||
`disables the default exclude methods such as "MarshalJSON"`) | ||
|
||
setting := recvcheck.Settings{ | ||
DisableBuiltin: noBuiltinExcludeMethod, | ||
} | ||
|
||
singlechecker.Main(recvcheck.NewAnalyzer(setting)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package test | ||
package basic | ||
|
||
import ( | ||
"time" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package disablebuiltin | ||
|
||
type Binary struct{} // want `the methods of "Binary" use pointer receiver and non-pointer receiver.` | ||
|
||
func (b Binary) MarshalBinary() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (b *Binary) UnmarshalBinary(data []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package disablebuiltin | ||
|
||
type Gob struct{} // want `the methods of "Gob" use pointer receiver and non-pointer receiver.` | ||
|
||
func (g Gob) GobEncode() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (g *Gob) GobDecode(data []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package disablebuiltin | ||
|
||
type JSON struct{} // want `the methods of "JSON" use pointer receiver and non-pointer receiver.` | ||
|
||
func (j JSON) MarshalJSON() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (j *JSON) UnmarshalJSON(b []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package disablebuiltin | ||
|
||
type Text struct{} // want `the methods of "Text" use pointer receiver and non-pointer receiver.` | ||
|
||
func (t Text) MarshalText() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (t *Text) UnmarshalText(b []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package disablebuiltin | ||
|
||
import "encoding/xml" | ||
|
||
type XML struct{} // want `the methods of "XML" use pointer receiver and non-pointer receiver.` | ||
|
||
func (x XML) MarshalXML(e *xml.Encoder, start xml.StartElement) error { | ||
panic("not implemented") | ||
} | ||
|
||
func (x *XML) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package disablebuiltin | ||
|
||
type Node struct{} | ||
|
||
type YAML struct{} // want `the methods of "YAML" use pointer receiver and non-pointer receiver.` | ||
|
||
func (j YAML) MarshalYAML() (any, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (j *YAML) UnmarshalYAML(value *Node) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package excluded | ||
|
||
type Binary struct{} | ||
|
||
func (b Binary) MarshalBinary() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (b *Binary) UnmarshalBinary(data []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package excluded | ||
|
||
type Gob struct{} | ||
|
||
func (g Gob) GobEncode() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (g *Gob) GobDecode(data []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package excluded | ||
|
||
type JSON struct{} | ||
|
||
func (j JSON) MarshalJSON() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (j *JSON) UnmarshalJSON(b []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package excluded | ||
|
||
type Text struct{} | ||
|
||
func (t Text) MarshalText() ([]byte, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (t *Text) UnmarshalText(b []byte) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package excluded | ||
|
||
import "encoding/xml" | ||
|
||
type XML struct{} | ||
|
||
func (x XML) MarshalXML(e *xml.Encoder, start xml.StartElement) error { | ||
panic("not implemented") | ||
} | ||
|
||
func (x *XML) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { | ||
panic("not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package excluded | ||
|
||
type Node struct{} | ||
|
||
type YAML struct{} | ||
|
||
func (j YAML) MarshalYAML() (any, error) { | ||
panic("not implemented") | ||
} | ||
|
||
func (j *YAML) UnmarshalYAML(value *Node) error { | ||
panic("not implemented") | ||
} |