You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the inline spacing/width of tags does not take comments into account.
In the example below, we see that the sql tag is placed 42 characters before the string start. Which looks strange because the fields are not aligned by their name or types due to the comment.
Also seeing this in my code, causing a conflict between golines and tagalign linter.
Applying golines to:
type ConnectionConfig struct {
Host string `env:"NEO4J_HOST,notEmpty"`
BoltPort int `env:"NEO4J_BOLT_PORT,notEmpty"`
SuperadminPassword string `env:"NEO4J_SUPERADMIN_PASSWORD,notEmpty"`
// Should only be used for development environments; makes the system log sensitive information
UseVerboseNeo4jLogging bool `env:"VERBOSE_NEO4J_LOGGING" envDefault:"false"`
}
yields:
type ConnectionConfig struct {
Host string `env:"NEO4J_HOST,notEmpty"`
BoltPort int `env:"NEO4J_BOLT_PORT,notEmpty"`
SuperadminPassword string `env:"NEO4J_SUPERADMIN_PASSWORD,notEmpty"`
// Should only be used for development environments; makes the system log sensitive information
UseVerboseNeo4jLogging bool `env:"VERBOSE_NEO4J_LOGGING" envDefault:"false"`
}
which breaks the linter with Error: .../config.go:8:30: tag is not aligned , should be: env:"VERBOSE_NEO4J_LOGGING" envDefault:"false" (tagalign)
with a newline added golines produces:
type ConnectionConfig struct {
Host string `env:"NEO4J_HOST,notEmpty"`
BoltPort int `env:"NEO4J_BOLT_PORT,notEmpty"`
SuperadminPassword string `env:"NEO4J_SUPERADMIN_PASSWORD,notEmpty"`
// Should only be used for development environments; makes the system log sensitive information
UseVerboseNeo4jLogging bool `env:"VERBOSE_NEO4J_LOGGING" envDefault:"false"`
}
which agrees with the linter
with comment removed golines produces:
type ConnectionConfig struct {
Host string `env:"NEO4J_HOST,notEmpty"`
BoltPort int `env:"NEO4J_BOLT_PORT,notEmpty"`
SuperadminPassword string `env:"NEO4J_SUPERADMIN_PASSWORD,notEmpty"`
UseVerboseNeo4jLogging bool `env:"VERBOSE_NEO4J_LOGGING" envDefault:"false"`
}
It seems that the inline spacing/width of tags does not take comments into account.
In the example below, we see that the
sql
tag is placed 42 characters before the string start. Which looks strange because the fields are not aligned by their name or types due to the comment.If we were to remove the comment, everything looks nicely aligned.
Likewise if we inserted a blank line before the comment:
This is the desired effect:
Since names and types are only aligned within groups of non-comment lines I think tags should respect that as well.
The text was updated successfully, but these errors were encountered: