Skip to content

Commit

Permalink
Refactor generate package
Browse files Browse the repository at this point in the history
  • Loading branch information
haoming29 committed Dec 1, 2023
1 parent 4998245 commit 8c9ac17
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
13 changes: 13 additions & 0 deletions generate/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

//go:generate go run ../generate

// This should not be included in any release of pelican

// Include more generator functions here but keep them encapsulated
// in their separate files under `generate` package
func main() {
GenParamEnum()
GenParamStruct()
GenPlaceholderPathForNext()
}
2 changes: 2 additions & 0 deletions generate/next_generator.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package main

// This should not be included in any release of pelican

import (
"log"
"os"
Expand Down
6 changes: 0 additions & 6 deletions generate/param_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ type TemplateData struct {
GeneratedCode string
}

func main() {
GenParamEnum()
GenParamStruct()
GenPlaceholderPathForNext()
}

var requiredKeys = [3]string{"description", "default", "type"}

func GenParamEnum() {
Expand Down
2 changes: 0 additions & 2 deletions param/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/spf13/viper"
)

//go:generate go run ../generate

var (
viperConfig *config
configMutex sync.RWMutex
Expand Down

0 comments on commit 8c9ac17

Please sign in to comment.