mirror of
				https://github.com/alecthomas/chroma.git
				synced 2025-10-30 23:57:49 +02:00 
			
		
		
		
	chore: upgrade go+golangci-lint
This commit is contained in:
		| @@ -51,6 +51,9 @@ linters: | ||||
|     - musttag | ||||
|     - depguard | ||||
|     - goconst | ||||
|     - perfsprint | ||||
|     - mnd | ||||
|     - predeclared | ||||
|  | ||||
| linters-settings: | ||||
|   govet: | ||||
|   | ||||
| @@ -1 +1 @@ | ||||
| .golangci-lint-1.55.2.pkg | ||||
| .golangci-lint-1.60.3.pkg | ||||
| @@ -141,7 +141,7 @@ func ParseColour(colour string) Colour { | ||||
| 	if err != nil { | ||||
| 		return 0 | ||||
| 	} | ||||
| 	return Colour(n + 1) | ||||
| 	return Colour(n + 1) //nolint:gosec | ||||
| } | ||||
|  | ||||
| // MustParseColour is like ParseColour except it panics if the colour is invalid. | ||||
| @@ -162,13 +162,13 @@ func (c Colour) String() string   { return fmt.Sprintf("#%06x", int(c-1)) } | ||||
| func (c Colour) GoString() string { return fmt.Sprintf("Colour(0x%06x)", int(c-1)) } | ||||
|  | ||||
| // Red component of colour. | ||||
| func (c Colour) Red() uint8 { return uint8(((c - 1) >> 16) & 0xff) } | ||||
| func (c Colour) Red() uint8 { return uint8(((c - 1) >> 16) & 0xff) } //nolint:gosec | ||||
|  | ||||
| // Green component of colour. | ||||
| func (c Colour) Green() uint8 { return uint8(((c - 1) >> 8) & 0xff) } | ||||
| func (c Colour) Green() uint8 { return uint8(((c - 1) >> 8) & 0xff) } //nolint:gosec | ||||
|  | ||||
| // Blue component of colour. | ||||
| func (c Colour) Blue() uint8 { return uint8((c - 1) & 0xff) } | ||||
| func (c Colour) Blue() uint8 { return uint8((c - 1) & 0xff) } //nolint:gosec | ||||
|  | ||||
| // Colours is an orderable set of colours. | ||||
| type Colours []Colour | ||||
|   | ||||
| @@ -10,11 +10,15 @@ import ( | ||||
|  | ||||
| // JSON formatter outputs the raw token structures as JSON. | ||||
| var JSON = Register("json", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error { | ||||
| 	fmt.Fprintln(w, "[") | ||||
| 	if _, err := fmt.Fprintln(w, "["); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	i := 0 | ||||
| 	for t := it(); t != chroma.EOF; t = it() { | ||||
| 		if i > 0 { | ||||
| 			fmt.Fprintln(w, ",") | ||||
| 			if _, err := fmt.Fprintln(w, ","); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		} | ||||
| 		i++ | ||||
| 		bytes, err := json.Marshal(t) | ||||
| @@ -25,7 +29,11 @@ var JSON = Register("json", chroma.FormatterFunc(func(w io.Writer, s *chroma.Sty | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
| 	fmt.Fprintln(w) | ||||
| 	fmt.Fprintln(w, "]") | ||||
| 	if _, err := fmt.Fprintln(w); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	if _, err := fmt.Fprintln(w, "]"); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| })) | ||||
|   | ||||
| @@ -157,7 +157,7 @@ func TestRulesSerialisation(t *testing.T) { | ||||
| 	data = re.ReplaceAll(data, []byte(`/>`)) | ||||
| 	b := &bytes.Buffer{} | ||||
| 	w := gzip.NewWriter(b) | ||||
| 	fmt.Fprintln(w, string(data)) | ||||
| 	fmt.Fprintln(w, string(data)) //nolint:errcheck | ||||
| 	w.Close() | ||||
| 	actual := Rules{} | ||||
| 	err = xml.Unmarshal(data, &actual) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user