Skip to content

Commit c3f62e3

Browse files
committed
Lint fixes
1 parent 10d5477 commit c3f62e3

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

resources/ct/ct.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (c *ContentTypesRollup) GetDestTable(ctID string, spec Spec) (*schema.Table
7171
propName += "Id"
7272
}
7373
if propName == prop {
74-
field = &fieldData
74+
field = fieldData
7575
break
7676
}
7777
}
@@ -111,10 +111,10 @@ func (c *ContentTypesRollup) GetDestTable(ctID string, spec Spec) (*schema.Table
111111
}
112112

113113
type contentTypeInfo struct {
114-
ID string `json:"StringId"`
115-
Name string `json:"Name"`
116-
Description string `json:"Description"`
117-
Fields []api.FieldInfo `json:"Fields"`
114+
ID string `json:"StringId"`
115+
Name string `json:"Name"`
116+
Description string `json:"Description"`
117+
Fields []*api.FieldInfo `json:"Fields"`
118118
}
119119

120120
func (c *ContentTypesRollup) getContentTypeInfo(ctID string) (*contentTypeInfo, error) {
@@ -141,49 +141,49 @@ func (c *ContentTypesRollup) getContentTypeInfo(ctID string) (*contentTypeInfo,
141141
return info[0], nil
142142
}
143143

144-
func (с *ContentTypesRollup) columnFromField(field *api.FieldInfo, tableName string) schema.Column {
145-
logger := с.logger.With().Str("table", tableName).Logger()
144+
func (c *ContentTypesRollup) columnFromField(field *api.FieldInfo, tableName string) schema.Column {
145+
logger := c.logger.With().Str("table", tableName).Logger()
146146

147-
c := schema.Column{
147+
col := schema.Column{
148148
Description: field.Description,
149149
}
150150

151151
switch field.TypeAsString {
152152
case "Text", "Note", "ContentTypeId":
153-
c.Type = schema.TypeString
153+
col.Type = schema.TypeString
154154
case "Integer", "Counter":
155-
c.Type = schema.TypeInt
155+
col.Type = schema.TypeInt
156156
case "Currency":
157-
c.Type = schema.TypeFloat
157+
col.Type = schema.TypeFloat
158158
case "Number":
159-
c.Type = schema.TypeFloat
159+
col.Type = schema.TypeFloat
160160
case "DateTime":
161-
c.Type = schema.TypeTimestamp
161+
col.Type = schema.TypeTimestamp
162162
case "Boolean", "Attachments":
163-
c.Type = schema.TypeBool
163+
col.Type = schema.TypeBool
164164
case "Guid":
165-
c.Type = schema.TypeUUID
165+
col.Type = schema.TypeUUID
166166
case "Lookup", "User":
167-
c.Type = schema.TypeInt
167+
col.Type = schema.TypeInt
168168
case "LookupMulti", "UserMulti":
169-
c.Type = schema.TypeIntArray
169+
col.Type = schema.TypeIntArray
170170
case "Choice":
171-
c.Type = schema.TypeString
171+
col.Type = schema.TypeString
172172
case "MultiChoice":
173-
c.Type = schema.TypeStringArray
173+
col.Type = schema.TypeStringArray
174174
case "Computed":
175-
c.Type = schema.TypeString
175+
col.Type = schema.TypeString
176176
default:
177177
logger.Warn().Str("type", field.TypeAsString).Int("kind", field.FieldTypeKind).Str("field_title", field.Title).Str("field_id", field.ID).Msg("unknown type, assuming JSON")
178-
c.Type = schema.TypeString
178+
col.Type = schema.TypeString
179179
}
180180

181-
c.Name = util.NormalizeEntityName(field.InternalName)
181+
col.Name = util.NormalizeEntityName(field.InternalName)
182182

183-
return c
183+
return col
184184
}
185185

186-
func (c *ContentTypesRollup) typeFromPropName(prop string) schema.ValueType {
186+
func (*ContentTypesRollup) typeFromPropName(prop string) schema.ValueType {
187187
if strings.HasSuffix(prop, "/Id") && prop != "ParentList/Id" {
188188
return schema.TypeInt
189189
}

resources/ct/sync.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func (c *ContentTypesRollup) Sync(ctx context.Context, metrics *source.TableClie
1818
logger := c.logger.With().Str("table", table.Name).Logger()
1919

2020
logger.Debug().Msgf("getting webs for %s", table.Name)
21-
webUrls, err := c.getWebs(ctx, c.sp.ToURL())
21+
webUrls, err := c.getWebs(c.sp.ToURL())
2222
if err != nil {
2323
return err
2424
}
@@ -27,7 +27,7 @@ func (c *ContentTypesRollup) Sync(ctx context.Context, metrics *source.TableClie
2727
// Iterate over all webs
2828
for _, webURL := range webUrls {
2929
logger.Debug().Msgf("getting lists for %s", webURL)
30-
lists, err := c.getLists(ctx, webURL, opts.ContentTypeID)
30+
lists, err := c.getLists(webURL, opts.ContentTypeID)
3131
if err != nil {
3232
return err
3333
}
@@ -44,7 +44,7 @@ func (c *ContentTypesRollup) Sync(ctx context.Context, metrics *source.TableClie
4444
return nil
4545
}
4646

47-
func (c *ContentTypesRollup) getWebs(ctx context.Context, webURL string) ([]string, error) {
47+
func (c *ContentTypesRollup) getWebs(webURL string) ([]string, error) {
4848
web := c.sp.Web().FromURL(fmt.Sprintf("%s/_api/Web", webURL))
4949

5050
resp, err := web.Webs().Select("Url,Webs/Url").Expand("Webs").Top(5000).Get()
@@ -67,7 +67,7 @@ func (c *ContentTypesRollup) getWebs(ctx context.Context, webURL string) ([]stri
6767
for _, web := range webs {
6868
webURLs = append(webURLs, web.URL)
6969
for _, subWeb := range web.Webs {
70-
subWebs, err := c.getWebs(ctx, subWeb.URL)
70+
subWebs, err := c.getWebs(subWeb.URL)
7171
if err != nil {
7272
return nil, err
7373
}
@@ -78,7 +78,7 @@ func (c *ContentTypesRollup) getWebs(ctx context.Context, webURL string) ([]stri
7878
return webURLs, nil
7979
}
8080

81-
func (c *ContentTypesRollup) getLists(ctx context.Context, webURL string, ctID string) ([]string, error) {
81+
func (c *ContentTypesRollup) getLists(webURL string, ctID string) ([]string, error) {
8282
web := c.sp.Web().FromURL(fmt.Sprintf("%s/_api/Web", webURL))
8383
resp, err := web.Lists().Select("Id,ContentTypes/StringId").Expand("ContentTypes").Top(5000).Get()
8484
if err != nil {

resources/lists/lists.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (l *Lists) GetDestTable(listURI string, spec Spec) (*schema.Table, error) {
9696
c := schema.Column{
9797
Name: util.NormalizeEntityName(fieldAlias),
9898
Description: prop,
99-
Type: l.typeFromPropName(prop),
99+
Type: typeFromPropName(prop),
100100
}
101101

102102
table.Columns = append(table.Columns, c)
@@ -182,7 +182,7 @@ func (l *Lists) columnFromField(field *api.FieldInfo, tableName string) schema.C
182182
return c
183183
}
184184

185-
func (l *Lists) typeFromPropName(prop string) schema.ValueType {
185+
func typeFromPropName(prop string) schema.ValueType {
186186
if strings.HasSuffix(prop, "/Id") && prop != "ParentList/Id" {
187187
return schema.TypeInt
188188
}

resources/mmd/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ type Spec struct {
88
}
99

1010
// SetDefault sets default values for MMD spec
11-
func (s *Spec) SetDefault() {}
11+
func (*Spec) SetDefault() {}

resources/profiles/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ type Spec struct {
99
}
1010

1111
// SetDefault sets default values for list spec
12-
func (s *Spec) SetDefault() {}
12+
func (*Spec) SetDefault() {}

0 commit comments

Comments
 (0)