feat: use make-go-great/diff-go to support diff dir

main
sudo pacman -Syu 2022-05-31 16:24:33 +07:00
parent 17e81c5644
commit 031091c978
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
3 changed files with 8 additions and 4 deletions

3
go.mod
View File

@ -4,7 +4,8 @@ go 1.18
require (
github.com/make-go-great/color-go v0.3.0
github.com/make-go-great/copy-go v0.8.0
github.com/make-go-great/copy-go v0.9.0
github.com/make-go-great/diff-go v0.0.3
github.com/urfave/cli/v2 v2.8.1
)

6
go.sum
View File

@ -4,8 +4,10 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/make-go-great/color-go v0.3.0 h1:ZVtVk/wVVsZZwSJG7PZpsY5zwIyGao5VoN48yKfSzYA=
github.com/make-go-great/color-go v0.3.0/go.mod h1:G5G8IJ3PUo+vSQ+UvnfaswF8O/piVIhFJKv1mQjBGpI=
github.com/make-go-great/copy-go v0.8.0 h1:AgMSCm4E6+2oZPQv9UR59nc0y1Q0TaYl88ypPJxjA4k=
github.com/make-go-great/copy-go v0.8.0/go.mod h1:QQii7A48OAcQMloNG5YV0USARmxHf3JLS9ieONO1WQA=
github.com/make-go-great/copy-go v0.9.0 h1:RTqVypNIa6liItFg6kORP93ZhgSck8+pupvGrnSzrSI=
github.com/make-go-great/copy-go v0.9.0/go.mod h1:J1ihIqaX3O/lGAaL23d+1GXSQwJX3RpStmUIUdh4xyw=
github.com/make-go-great/diff-go v0.0.3 h1:LEBt+oJ3KR8DDDIVKC7H/oONf+eKmQfUgQOTzskZfTc=
github.com/make-go-great/diff-go v0.0.3/go.mod h1:vRXh6owtk7WrPoIooBGYEzUIRT67fVUPZwqYDu7jt44=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=

View File

@ -6,6 +6,7 @@ import (
"path/filepath"
"github.com/make-go-great/copy-go"
"github.com/make-go-great/diff-go"
)
type configReal struct {
@ -61,7 +62,7 @@ func (c *configReal) Clean() error {
func (c *configReal) Compare() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
if err := copy.Compare(p.Internal, p.External); err != nil {
if err := diff.Diff(p.Internal, p.External); err != nil {
return fmt.Errorf("failed to compare %s with %s: %w", p.Internal, p.External, err)
}
}