Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary code #292

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmd/idpscimcli/cmd/common.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
package cmd

import (
"encoding/json"
"fmt"

"github.com/slashdevops/idp-scim-sync/internal/convert"
"gopkg.in/yaml.v3"
)

// show resource structure as outFormat
func show(outFormat string, resource interface{}) {
switch outFormat {
case "json":
fmt.Print(convert.ToJSONString(resource, true))
j, _ := json.MarshalIndent(resource, "", " ")
fmt.Print(string(j))
case "yaml":
fmt.Print(convert.ToYAML(resource))
y, _ := yaml.Marshal(resource)
fmt.Print(string(y))
default:
fmt.Print(convert.ToJSONString(resource, true))
j, _ := json.MarshalIndent(resource, "", " ")
fmt.Print(string(j))
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ require (
github.com/aws/smithy-go v1.22.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -64,8 +64,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config

const (
// DefaultIsLambda is the progam execute as a lambda function?
// DefaultIsLambda is the program execute as a lambda function?
DefaultIsLambda = false

// DefaultLogLevel is the default logging level.
58 changes: 0 additions & 58 deletions internal/convert/convert.go

This file was deleted.

201 changes: 0 additions & 201 deletions internal/convert/convert_test.go

This file was deleted.

5 changes: 2 additions & 3 deletions internal/core/options_test.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import (
"testing"

gomock "github.com/golang/mock/gomock"
"github.com/slashdevops/idp-scim-sync/internal/convert"
mocks "github.com/slashdevops/idp-scim-sync/mocks/core"
)

@@ -53,7 +52,7 @@ func TestWithIdentityProviderGroupsFilter(t *testing.T) {
}

if !reflect.DeepEqual(got, want) {
t.Errorf("NewSyncService() got = %s, want %s", convert.ToJSONString(got, true), convert.ToJSONString(want, true))
t.Errorf("NewSyncService() got = %s, want %s", got, want)
}
})
}
@@ -102,7 +101,7 @@ func TestWithIdentityProviderUsersFilter(t *testing.T) {
}

if !reflect.DeepEqual(got, want) {
t.Errorf("NewSyncService() got = %s, want %s", convert.ToJSONString(got, true), convert.ToJSONString(want, true))
t.Errorf("NewSyncService() got = %s, want %s", got, want)
}
})
}
3 changes: 1 addition & 2 deletions internal/idp/helpers.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import (
"log/slog"
"strings"

"github.com/slashdevops/idp-scim-sync/internal/convert"
"github.com/slashdevops/idp-scim-sync/internal/model"
admin "google.golang.org/api/admin/directory/v1"
)
@@ -232,7 +231,7 @@ func buildUser(usr *admin.User) *model.User {
WithEnterpriseData(mainOrganization).
Build()

slog.Debug("idp: buildUser() converted user", "from", convert.ToJSONString(usr), "to", convert.ToJSONString(userModel))
slog.Debug("idp: buildUser() converted user", "from", usr, "to", userModel)

return userModel
}
7 changes: 0 additions & 7 deletions internal/model/group_test.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/slashdevops/idp-scim-sync/internal/convert"
)

func TestGroup_SetHashCode(t *testing.T) {
@@ -238,12 +237,6 @@ func TestGroupsResult_SetHashCode(t *testing.T) {
gr5 := MergeGroupsResult(&gr3, &gr2, &gr1)
gr5.SetHashCode()

t.Logf("gr4: %s\n", convert.ToJSON(gr4, true))
t.Logf("gr5: %s\n", convert.ToJSON(gr5, true))

t.Logf("gr4.HashCode: %s\n", gr4.HashCode)
t.Logf("gr5.HashCode: %s\n", gr5.HashCode)

if gr1.HashCode != gr2.HashCode {
t.Errorf("GroupsResult.HashCode should be equal")
}
Loading