Skip to content

Commit

Permalink
Rename to go-ignore
Browse files Browse the repository at this point in the history
Renamed to go-ignore, emphasising that the parsed format is not
restricted to gitignore files, but potentially other (dockerignore)
formats too

The differences between .gitignore, .dockerignore are due to the
interpretation of the paths, which this package makes no effort to
handle
  • Loading branch information
shteou committed Oct 22, 2020
1 parent 5975cb7 commit 3f48da9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# go-gitignore
# go-ignore

A simple gitignore format parser.
A simple gitignore/dockerignore format parser.

This package parses .gitignore files into a publicly exposed struct for usage in other
packages. It does not provide any matching capabilities, nor does it support
marshalling the gitignore Entries.
This package parses .gitignore and .dockerignore files into a publicly exposed struct
for usage in other packages. It does not provide any matching capabilities, nor does it support
marshalling the Entries.

## .gitignore vs .dockerignore

There are functional differences between .gitignore and .dockerignore. This is manifest in
how files/directories are matched, but that functionality is beyond the scope of this package.

From a file structure perspective the two formats are deemed equivalent, in that both support
paths, negated paths, comments, and whitespace lines.

## API

Expand Down Expand Up @@ -34,7 +42,7 @@ package main
import (
"fmt"

ignore "github.com/shteou/go-gitignore"
ignore "github.com/shteou/go-ignore"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/shteou/go-gitignore
module github.com/shteou/go-ignore

go 1.13

Expand Down
4 changes: 2 additions & 2 deletions ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Unescape(s string) string {
}

// ParseIgnoreLines Parse the supplied lines into a Go representation of that those
// gitignore entries
// ignore entries
func ParseIgnoreLines(lines []string) ([]Entry, error) {
ignoreEntries := []Entry{}

Expand All @@ -62,7 +62,7 @@ func ParseIgnoreLines(lines []string) ([]Entry, error) {
}

// ParseIgnoreBytes Parse the supplied byte array into a Go representation of those
// gitignore entries
// gnore entries
func ParseIgnoreBytes(bytes []byte) ([]Entry, error) {
lines := strings.Split(string(bytes), "\n")
return ParseIgnoreLines(lines)
Expand Down

0 comments on commit 3f48da9

Please sign in to comment.