envdoc icon indicating copy to clipboard operation
envdoc copied to clipboard

-types='*' is not working, -all is

Open itsab11 opened this issue 1 year ago • 2 comments

version used: 1.0.0 go version 1.22.6

//go:generate envdoc --output environment.md -all
type Appconfig struct {
	// Environment, has some effects on logging. Options are: production, debug, development
	Environment string `env:"ENVIRONMENT" envDefault:"production"`
	// timeout in seconds for DB operations like select or insert
	Timeout_DB int `env:"TIMEOUT_DB" envDefault:"10"`
}

// DBconfig contains all env values needed for configuration of the database connection
type DBconfig struct {
	// Username of Metadatastore Service-Account
	DB_User string `env:"DB_USER,notEmpty"`
	// Password of Metadatastore Service-Account
	DB_Pass string `env:"DB_PASS,notEmpty"`
}

in a situation like this, the new flag -types='*' results in an empty file, while -all is working, despite the warning.

itsab11 avatar Aug 09 '24 09:08 itsab11

@itsab11 could you add please -debug flag to envdoc args and put the output here?

//go:generate envdoc -debug ...

g4s8 avatar Aug 11 '24 07:08 g4s8

Sure thing!

I am posting only the last bit, not the whole traversing logs.

with -all: Resolved types:

main.app: "app" (export=true)
main.DataStore: "DataStore" (export=true)
main.ORACLE: "ORACLE" (export=true)
main.Downloader: "Downloader" (export=true)
main.ForwardFile: "ForwardFile" (export=true)
main.UploadResponse: "UploadResponse" (export=true)
main.Appconfig: "Appconfig" (export=true)
main.DBconfig: "DBconfig" (export=true)
main.ProgressReader: "ProgressReader" (export=true)
# CONV: skip file "app.go"
      # CONV: field [Environment1]
      # CONV: docItem "ENVIRONMENT" (0 childrens)
      # CONV: field [Timeout_DB1]
      # CONV: docItem "TIMEOUT_DB" (0 childrens)
# CONV: found scope "Appconfig"
      # CONV: field [DB_User1]
      # CONV: docItem "DB_USER" (0 childrens)
      # CONV: field [DB_Pass1]
      # CONV: docItem "DB_PASS" (0 childrens)
# CONV: found scope "DBconfig"
# CONV: skip file "database.go"
# CONV: skip file "downAndUploader.go"
# CONV: skip file "forwarderlib.go"
# CONV: skip file "main.go"
Scopes tree:
- "Appconfig"
- "ENVIRONMENT"
- "TIMEOUT_DB"
- "DBconfig"
- "DB_USER"
- "DB_PASS"

with -types='*' :

Resolved types:
  main.ForwardFile: "ForwardFile" (export=false)
  main.Appconfig: "Appconfig" (export=false)
  main.DataStore: "DataStore" (export=false)
  main.ORACLE: "ORACLE" (export=false)
  main.Downloader: "Downloader" (export=false)
  main.ProgressReader: "ProgressReader" (export=false)
  main.UploadResponse: "UploadResponse" (export=false)
  main.app: "app" (export=false)
  main.DBconfig: "DBconfig" (export=false)
# CONV: skip file "app.go"
# CONV: skip type "Appconfig"
# CONV: skip type "DBconfig"
# CONV: skip file "database.go"
# CONV: skip file "downAndUploader.go"
# CONV: skip file "forwarderlib.go"
# CONV: skip file "main.go"
Scopes tree:

To me it looks like with types, it interprets everything as unexported which is the reason for not generating anything.

itsab11 avatar Aug 13 '24 08:08 itsab11

could you please add the beginning of the logs (or full log), i suppose there could be issue with * escaping, need to see the config parsing logs

g4s8 avatar Aug 19 '24 13:08 g4s8

This should be fixed (most probably) by unescaping glob patterns, where you use '*' or "*" args. Please try v1.0.1 release

g4s8 avatar Aug 19 '24 14:08 g4s8

sorry for the late answer. I just tried the new version, now it works! thank you so much for your effort.

Time to generate some docs :)

schleicherse avatar Aug 30 '24 13:08 schleicherse