Skip to content

Commit f5396bd

Browse files
authored
dev: fix JSONSchema publication (#5395)
1 parent 2b74eba commit f5396bd

File tree

1 file changed

+11
-11
lines changed
  • scripts/website/copy_jsonschema

1 file changed

+11
-11
lines changed

scripts/website/copy_jsonschema/main.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ func copyLatestSchema(dstDir string) error {
5858
fmt.Sprintf("golangci.v%d.%d.jsonschema.json", version.Segments()[0], version.Segments()[1]),
5959
}
6060

61+
for _, dst := range files {
62+
err = copyFile(filepath.Join(dstDir, dst), src)
63+
if err != nil {
64+
return fmt.Errorf("copy file %s to %s: %w", src, dst, err)
65+
}
66+
}
67+
68+
return nil
69+
}
70+
71+
func copyFile(dst, src string) error {
6172
source, err := os.Open(src)
6273
if err != nil {
6374
return fmt.Errorf("open file %s: %w", src, err)
@@ -70,17 +81,6 @@ func copyLatestSchema(dstDir string) error {
7081
return fmt.Errorf("file %s not found: %w", src, err)
7182
}
7283

73-
for _, dst := range files {
74-
err = copyFile(filepath.Join(dstDir, dst), source, info)
75-
if err != nil {
76-
return fmt.Errorf("copy file %s to %s: %w", src, dst, err)
77-
}
78-
}
79-
80-
return nil
81-
}
82-
83-
func copyFile(dst string, source io.Reader, info os.FileInfo) error {
8484
destination, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
8585
if err != nil {
8686
return fmt.Errorf("create file %s: %w", dst, err)

0 commit comments

Comments
 (0)