@@ -58,6 +58,17 @@ func copyLatestSchema(dstDir string) error {
58
58
fmt .Sprintf ("golangci.v%d.%d.jsonschema.json" , version .Segments ()[0 ], version .Segments ()[1 ]),
59
59
}
60
60
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 {
61
72
source , err := os .Open (src )
62
73
if err != nil {
63
74
return fmt .Errorf ("open file %s: %w" , src , err )
@@ -70,17 +81,6 @@ func copyLatestSchema(dstDir string) error {
70
81
return fmt .Errorf ("file %s not found: %w" , src , err )
71
82
}
72
83
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 {
84
84
destination , err := os .OpenFile (dst , os .O_RDWR | os .O_CREATE | os .O_TRUNC , info .Mode ())
85
85
if err != nil {
86
86
return fmt .Errorf ("create file %s: %w" , dst , err )
0 commit comments