File: README.md

package info (click to toggle)
golang-mvdan-editorconfig 0.2.0%2Bgit20240816.eab549b-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: makefile: 9
file content (30 lines) | stat: -rw-r--r-- 973 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# editorconfig

[![GoDoc](https://godoc.org/mvdan.cc/editorconfig?status.svg)](https://godoc.org/mvdan.cc/editorconfig)

A small package to parse and use [EditorConfig][1] files. Currently passes all
of the official [test cases][2], which are run via `go test`.

```go
props, err := editorconfig.Find("path/to/file.go")
if err != nil { ... }

// Print all the properties
fmt.Println(props)

// Query specific ones
fmt.Println(props.Get("indent_style"))
fmt.Println(props.IndentSize())
```

Note that an [official library][3] exists for Go. This alternative
implementation started with a different design:

* Specialised INI parser, for full compatibility with the spec
* Ability to cache parsing files and compiling pattern matches
* Storing and querying all properties equally
* Minimising pointers and maps to store data

[1]: https://editorconfig.org/
[2]: https://github.com/editorconfig/editorconfig-core-test
[3]: https://github.com/editorconfig/editorconfig-core-go