summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2024-08-28 00:14:30 +0200
committerJulien Dessaux2024-08-28 00:15:36 +0200
commit14511b320186c8eb4a2905a348fed533bb9a4814 (patch)
tree4b6a0123d688536eae4a3ccc8085a76088d2b294
parentfeat(files): support creating directories (diff)
downloadgonf-14511b320186c8eb4a2905a348fed533bb9a4814.tar.gz
gonf-14511b320186c8eb4a2905a348fed533bb9a4814.tar.bz2
gonf-14511b320186c8eb4a2905a348fed533bb9a4814.zip
chore(gonf): change Promise() methods return type to be more specific
Diffstat (limited to '')
-rw-r--r--pkg/commands.go2
-rw-r--r--pkg/custom.go2
-rw-r--r--pkg/files.go2
-rw-r--r--pkg/packages.go2
-rw-r--r--pkg/promises.go21
-rw-r--r--pkg/services.go2
-rw-r--r--pkg/users.go2
-rw-r--r--stdlib/backups/borg/server.go2
8 files changed, 7 insertions, 28 deletions
diff --git a/pkg/commands.go b/pkg/commands.go
index 096da11..4222de7 100644
--- a/pkg/commands.go
+++ b/pkg/commands.go
@@ -43,7 +43,7 @@ func (c *CommandPromise) IfRepaired(p ...Promise) Promise {
return c
}
-func (c *CommandPromise) Promise() Promise {
+func (c *CommandPromise) Promise() *CommandPromise {
commands = append(commands, c)
return c
}
diff --git a/pkg/custom.go b/pkg/custom.go
index 9b4ca3d..bc1a531 100644
--- a/pkg/custom.go
+++ b/pkg/custom.go
@@ -21,7 +21,7 @@ func (c *CustomPromise) IfRepaired(p ...Promise) Promise {
return c
}
-func (c *CustomPromise) Promise() Promise {
+func (c *CustomPromise) Promise() *CustomPromise {
customPromises = append(customPromises, c)
return c
}
diff --git a/pkg/files.go b/pkg/files.go
index 23c27d9..6f22176 100644
--- a/pkg/files.go
+++ b/pkg/files.go
@@ -87,7 +87,7 @@ func (f *FilePromise) IfRepaired(p ...Promise) Promise {
return f
}
-func (f *FilePromise) Promise() Promise {
+func (f *FilePromise) Promise() *FilePromise {
files = append(files, f)
return f
}
diff --git a/pkg/packages.go b/pkg/packages.go
index 87db647..7ed8584 100644
--- a/pkg/packages.go
+++ b/pkg/packages.go
@@ -35,7 +35,7 @@ func (p *PackagePromise) IfRepaired(ps ...Promise) Promise {
return p
}
-func (p *PackagePromise) Promise() Promise {
+func (p *PackagePromise) Promise() *PackagePromise {
packages = append(packages, p)
return p
}
diff --git a/pkg/promises.go b/pkg/promises.go
index 8495650..0198296 100644
--- a/pkg/promises.go
+++ b/pkg/promises.go
@@ -2,31 +2,10 @@ package gonf
type Promise interface {
IfRepaired(...Promise) Promise
- Promise() Promise
Resolve()
Status() Status
}
-//type Operation int
-//
-//const (
-// AND = iota
-// OR
-// NOT
-//)
-//
-//func (o Operation) String() string {
-// switch o {
-// case AND:
-// return "and"
-// case OR:
-// return "or"
-// case NOT:
-// return "not"
-// }
-// panic("unknown")
-//}
-
type Status int
const (
diff --git a/pkg/services.go b/pkg/services.go
index 319599e..6368573 100644
--- a/pkg/services.go
+++ b/pkg/services.go
@@ -42,7 +42,7 @@ func (s *ServicePromise) IfRepaired(p ...Promise) Promise {
return s
}
-func (s *ServicePromise) Promise() Promise {
+func (s *ServicePromise) Promise() *ServicePromise {
services = append(services, s)
return s
}
diff --git a/pkg/users.go b/pkg/users.go
index 2577207..14a8acd 100644
--- a/pkg/users.go
+++ b/pkg/users.go
@@ -46,7 +46,7 @@ func (u *UserPromise) IfRepaired(p ...Promise) Promise {
return u
}
-func (u *UserPromise) Promise() Promise {
+func (u *UserPromise) Promise() *UserPromise {
users = append(users, u)
return u
}
diff --git a/stdlib/backups/borg/server.go b/stdlib/backups/borg/server.go
index 95768da..2ef1d7e 100644
--- a/stdlib/backups/borg/server.go
+++ b/stdlib/backups/borg/server.go
@@ -20,7 +20,7 @@ func (b *BorgServer) IfRepaired(p ...gonf.Promise) gonf.Promise {
return b
}
-func (b *BorgServer) Promise() gonf.Promise {
+func (b *BorgServer) Promise() *BorgServer {
gonf.MakeCustomPromise(b).Promise()
return b
}