X Tutup
Skip to content

Commit 05b92db

Browse files
author
Nate Smith
authored
Merge pull request cli#168 from github/goodbye-migration
Remove migration function
2 parents 839e411 + 63f35f6 commit 05b92db

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

context/config_file.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77
"io/ioutil"
88
"os"
9-
"path"
109

1110
"gopkg.in/yaml.v3"
1211
)
@@ -25,8 +24,6 @@ func parseOrSetupConfigFile(fn string) (*configEntry, error) {
2524
}
2625

2726
func parseConfigFile(fn string) (*configEntry, error) {
28-
migrateConfigFile()
29-
3027
f, err := os.Open(fn)
3128
if err != nil {
3229
return nil, err
@@ -65,44 +62,3 @@ func parseConfig(r io.Reader) (*configEntry, error) {
6562
}
6663
return nil, fmt.Errorf("could not find config entry for %q", defaultHostname)
6764
}
68-
69-
// This is a temporary function that will migrate the config file. It can be removed
70-
// in January.
71-
//
72-
// If the config dir is a file, convert it to a directory and place the file
73-
// into a file named config.yml
74-
func migrateConfigFile() {
75-
p := ConfigDir()
76-
fi, err := os.Stat(p)
77-
if err != nil { // This means the file doesn't exist, and that is fine.
78-
return
79-
}
80-
if fi.Mode().IsDir() {
81-
return
82-
}
83-
84-
content, err := ioutil.ReadFile(p)
85-
if err != nil {
86-
fmt.Fprintf(os.Stderr, "migration error: failed to read config at %s", p)
87-
return
88-
}
89-
90-
err = os.Remove(p)
91-
if err != nil {
92-
fmt.Fprintf(os.Stderr, "migration error: failed to remove %s", p)
93-
return
94-
}
95-
96-
err = os.MkdirAll(p, 0771)
97-
if err != nil {
98-
fmt.Fprintf(os.Stderr, "migration error: failed to mkdir %s", p)
99-
return
100-
}
101-
102-
newPath := path.Join(p, "config.yml")
103-
err = ioutil.WriteFile(newPath, []byte(content), 0771)
104-
if err != nil {
105-
fmt.Fprintf(os.Stderr, "migration error: failed write to new config path %s", newPath)
106-
return
107-
}
108-
}

0 commit comments

Comments
 (0)
X Tutup