Closed thomaspeugeot closed 1 year ago
package main
import (
"fmt"
"log"
"os"
gitignore "github.com/sabhiram/go-gitignore"
)
func main() {
ignorePatterns, err := gitignore.CompileIgnoreFile(".gitignore")
if err != nil {
log.Fatalf("Failed to compile .gitignore: %v", err)
}
// Sample file paths to test
paths := []string{
"test.txt",
"bin/output",
"src/ignored_file.go",
}
for _, path := range paths {
if ignorePatterns.MatchesPath(path) {
fmt.Printf("%s is ignored\n", path)
} else {
fmt.Printf("%s is NOT ignored\n", path)
}
}
}
Sometime the front end project is not necessary (no need for the API).
Alternative:
A:
minus: magic code is a departure from "pure go code" approach, maintenance is complex.
minus: no obvious place to put the magic code. Within the docs.go file ? It is a generated file.
Maybe in .frontignore file that provides a pattern for parsing go files similar to the gitingore syntax "*"
Let's try this solution. It is more maintainable that magic code or compiler options.
IsIgnoredForFront bool
IsIgnoredForFront
(gitignore "github.com/sabhiram/go-gitignore")