Skip to content

Commit 4417f98

Browse files
committed
Fix opam file initialization
1 parent 84f9eb8 commit 4417f98

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

init_proj/init_proj.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type ProjectData struct {
2626
ProjectName string
2727
}
2828

29-
func updatePerennialPin(opamFileName string) error {
30-
contents, err := os.ReadFile(opamFileName)
29+
func updatePerennialPin(opamPath string) error {
30+
contents, err := os.ReadFile(opamPath)
3131
if err != nil {
3232
panic("could not read back opam file")
3333
}
@@ -49,7 +49,7 @@ func updatePerennialPin(opamFileName string) error {
4949
if err != nil {
5050
return fmt.Errorf("failed to update indirect dependencies: %w", err)
5151
}
52-
if err := os.WriteFile(opamFileName, []byte(f.String()), 0644); err != nil {
52+
if err := os.WriteFile(opamPath, []byte(f.String()), 0644); err != nil {
5353
panic("could not write back opam file")
5454
}
5555
fmt.Printf("added perennial dependency\n")
@@ -181,7 +181,7 @@ func New(url, projectName, dir string) error {
181181
fmt.Printf("created %s\n", fileInfo.outputPath)
182182
}
183183

184-
if err := updatePerennialPin(opamFileName); err != nil {
184+
if err := updatePerennialPin(filepath.Join(dir, opamFileName)); err != nil {
185185
return err
186186
}
187187

0 commit comments

Comments
 (0)