mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
chore: format Go more aggressively
This commit is contained in:
@ -91,7 +91,7 @@ func prepareDocsDirectory() error {
|
||||
return xerrors.Errorf(`os.RemoveAll failed for "%s": %w`, apiPath, err)
|
||||
}
|
||||
|
||||
err = os.MkdirAll(apiPath, 0755)
|
||||
err = os.MkdirAll(apiPath, 0o755)
|
||||
if err != nil {
|
||||
return xerrors.Errorf(`os.MkdirAll failed for "%s": %w`, apiPath, err)
|
||||
}
|
||||
@ -102,7 +102,7 @@ func writeDocs(sections [][]byte) error {
|
||||
log.Println("Write docs to destination")
|
||||
|
||||
apiDir := path.Join(docsDirectory, apiSubdir)
|
||||
err := os.WriteFile(path.Join(apiDir, apiIndexFile), []byte(apiIndexContent), 0644) // #nosec
|
||||
err := os.WriteFile(path.Join(apiDir, apiIndexFile), []byte(apiIndexContent), 0o644) // #nosec
|
||||
if err != nil {
|
||||
return xerrors.Errorf(`can't write the index file: %w`, err)
|
||||
}
|
||||
@ -123,7 +123,7 @@ func writeDocs(sections [][]byte) error {
|
||||
|
||||
mdFilename := toMdFilename(sectionName)
|
||||
docPath := path.Join(apiDir, mdFilename)
|
||||
err = os.WriteFile(docPath, section, 0644) // #nosec
|
||||
err = os.WriteFile(docPath, section, 0o644) // #nosec
|
||||
if err != nil {
|
||||
return xerrors.Errorf(`can't write doc file "%s": %w`, docPath, err)
|
||||
}
|
||||
@ -196,7 +196,7 @@ func writeDocs(sections [][]byte) error {
|
||||
return xerrors.Errorf("json.Marshal failed: %w", err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(manifestPath, manifestFile, 0644) // #nosec
|
||||
err = os.WriteFile(manifestPath, manifestFile, 0o644) // #nosec
|
||||
if err != nil {
|
||||
return xerrors.Errorf("can't write manifest file: %w", err)
|
||||
}
|
||||
|
@ -780,8 +780,10 @@ func (g *Generator) typescriptType(ty types.Type) (TypescriptType, error) {
|
||||
// only handle the empty interface for now
|
||||
intf := ty
|
||||
if intf.Empty() {
|
||||
return TypescriptType{ValueType: "any",
|
||||
AboveTypeLine: indentedComment("eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO explain why this is needed")}, nil
|
||||
return TypescriptType{
|
||||
ValueType: "any",
|
||||
AboveTypeLine: indentedComment("eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO explain why this is needed"),
|
||||
}, nil
|
||||
}
|
||||
return TypescriptType{}, xerrors.New("only empty interface types are supported")
|
||||
case *types.TypeParam:
|
||||
|
6
scripts/apitypings/testdata/enums/enums.go
vendored
6
scripts/apitypings/testdata/enums/enums.go
vendored
@ -1,7 +1,9 @@
|
||||
package enums
|
||||
|
||||
type Enum string
|
||||
type Enums []Enum
|
||||
type (
|
||||
Enum string
|
||||
Enums []Enum
|
||||
)
|
||||
|
||||
const (
|
||||
EnumFoo Enum = "foo"
|
||||
|
@ -152,7 +152,7 @@ func updateAuditDoc(doc []byte, auditableResourcesMap AuditableResourcesMap) ([]
|
||||
func writeAuditDoc(doc []byte) error {
|
||||
// G306: Expect WriteFile permissions to be 0600 or less
|
||||
/* #nosec G306 */
|
||||
return os.WriteFile(auditDocFile, doc, 0644)
|
||||
return os.WriteFile(auditDocFile, doc, 0o644)
|
||||
}
|
||||
|
||||
func sortKeys[T any](stringMap map[string]T) []string {
|
||||
|
@ -143,7 +143,7 @@ func updatePrometheusDoc(doc []byte, metricFamilies []dto.MetricFamily) ([]byte,
|
||||
func writePrometheusDoc(doc []byte) error {
|
||||
// G306: Expect WriteFile permissions to be 0600 or less
|
||||
/* #nosec G306 */
|
||||
err := os.WriteFile(prometheusDocFile, doc, 0644)
|
||||
err := os.WriteFile(prometheusDocFile, doc, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user