Skip to content
v0.5.0

Initial release of this module. This module was extracted from pkg/fileutils
in the  github.com/docker/docker/ repository, from this commit:
https://github.com/moby/moby/tree/a392e6cecb815a7b2b784efd2dd40d04df50e580/pkg/fileutils

The package was moved to a separate repository, using the steps below:

    # install filter-repo (https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)
    brew install git-filter-repo

    cd ~/projects

    # create a temporary clone of docker
    git clone https://github.com/docker/docker.git moby_patternmatcher_temp
    cd moby_patternmatcher_temp

    # for reference
    git rev-parse HEAD
    # --> a392e6cecb815a7b2b784efd2dd40d04df50e580

    # remove all code, except for the files we need, and rename the files
    git filter-repo \
        --path LICENSE \
        --path NOTICE \
        --path-match pkg/fileutils/fileutils.go \
        --path-match pkg/fileutils/fileutils_test.go \
        --path-rename pkg/fileutils/fileutils.go:patternmatcher.go \
        --path-rename pkg/fileutils/fileutils_test.go:patternmatcher_test.go

    # remove canonical imports
    git revert -s -S 06258607c121980cf8cabe9bd295012540d9081a

    # initialize module
    go mod init github.com/moby/patternmatcher
    go mod tidy

After this;

- a go.mod was added, and the package names renamed
- functions unrelated to matching were removed
- NewPatternMatcher was renamed to New
- GitHub actions were added

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>