fullstack-lang / gong

Gong (go+ng) is a go sub-language that compiles to go and angular. All valid go is valid gong and vice versa. Gong enables fast development of web applications. Gong is model centric and by default, a UML diagram editor of the model is embedded in each application.
MIT License
14 stars 1 forks source link

Add an option to initiate the front end #359

Closed thomaspeugeot closed 1 year ago

thomaspeugeot commented 1 year ago

Sometime the front end project is not necessary (no need for the API).

    initiateFrontApi = flag.Bool("initiateFrontApi", false, "generate <pkgname> project in the ng workspace, and then generate at each compilation, unless  <pkgname> project directory is suppressed 

Alternative:

A:

Let's try this solution. It is more maintainable that magic code or compiler options.

thomaspeugeot commented 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)
        }
    }
}