Add lint rule to use any instead of interface{} (#3685)

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)

* #3654

#### Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-06-27 13:34:30 -07:00 committed by GitHub
parent 10c8fd9d12
commit ce3ecacbe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 12 deletions

View File

@ -81,6 +81,7 @@ linters-settings:
- name: time-equal - name: time-equal
- name: time-naming - name: time-naming
- name: unreachable-code - name: unreachable-code
- name: use-any
- name: useless-break - name: useless-break
- name: var-declaration - name: var-declaration
- name: var-naming - name: var-naming

View File

@ -15,7 +15,7 @@ import (
"github.com/alcionai/corso/src/pkg/path" "github.com/alcionai/corso/src/pkg/path"
) )
type boolfAssertionFunc func(assert.TestingT, bool, string, ...interface{}) bool type boolfAssertionFunc func(assert.TestingT, bool, string, ...any) bool
type testCase struct { type testCase struct {
service path.ServiceType service path.ServiceType

View File

@ -2497,7 +2497,7 @@ func fileItem(
deleted bool, deleted bool,
) models.DriveItemable { ) models.DriveItemable {
di := driveItem(id, name, parentPath, parentID, true, false, false) di := driveItem(id, name, parentPath, parentID, true, false, false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@microsoft.graph.downloadUrl": url, "@microsoft.graph.downloadUrl": url,
}) })

View File

@ -315,7 +315,7 @@ func (suite *ItemUnitTestSuite) TestDownloadItem() {
name: "success", name: "success",
itemFunc: func() models.DriveItemable { itemFunc: func() models.DriveItemable {
di := newItem("test", false) di := newItem("test", false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@microsoft.graph.downloadUrl": url, "@microsoft.graph.downloadUrl": url,
}) })
@ -334,7 +334,7 @@ func (suite *ItemUnitTestSuite) TestDownloadItem() {
name: "success, content url set instead of download url", name: "success, content url set instead of download url",
itemFunc: func() models.DriveItemable { itemFunc: func() models.DriveItemable {
di := newItem("test", false) di := newItem("test", false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@content.downloadUrl": url, "@content.downloadUrl": url,
}) })
@ -353,7 +353,7 @@ func (suite *ItemUnitTestSuite) TestDownloadItem() {
name: "api getter returns error", name: "api getter returns error",
itemFunc: func() models.DriveItemable { itemFunc: func() models.DriveItemable {
di := newItem("test", false) di := newItem("test", false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@microsoft.graph.downloadUrl": url, "@microsoft.graph.downloadUrl": url,
}) })
@ -384,7 +384,7 @@ func (suite *ItemUnitTestSuite) TestDownloadItem() {
name: "malware", name: "malware",
itemFunc: func() models.DriveItemable { itemFunc: func() models.DriveItemable {
di := newItem("test", false) di := newItem("test", false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@microsoft.graph.downloadUrl": url, "@microsoft.graph.downloadUrl": url,
}) })
@ -406,7 +406,7 @@ func (suite *ItemUnitTestSuite) TestDownloadItem() {
name: "non-2xx http response", name: "non-2xx http response",
itemFunc: func() models.DriveItemable { itemFunc: func() models.DriveItemable {
di := newItem("test", false) di := newItem("test", false)
di.SetAdditionalData(map[string]interface{}{ di.SetAdditionalData(map[string]any{
"@microsoft.graph.downloadUrl": url, "@microsoft.graph.downloadUrl": url,
}) })

View File

@ -51,7 +51,7 @@ func NewRestoreCaches() *restoreCaches {
DriveIDToRootFolderID: map[string]string{}, DriveIDToRootFolderID: map[string]string{},
// Buffer pool for uploads // Buffer pool for uploads
pool: sync.Pool{ pool: sync.Pool{
New: func() interface{} { New: func() any {
b := make([]byte, graph.CopyBufferSize) b := make([]byte, graph.CopyBufferSize)
return &b return &b
}, },

View File

@ -116,7 +116,7 @@ func List(title, columnName string, items map[string]string) models.Listable {
itms := make([]models.ListItemable, 0) itms := make([]models.ListItemable, 0)
for k, v := range items { for k, v := range items {
entry := map[string]interface{}{ entry := map[string]any{
"Title": k, "Title": k,
columnName: v, columnName: v,
} }

View File

@ -302,7 +302,7 @@ func fixupExceptionOccurrences(
// This odd roundabout way of doing this is required as // This odd roundabout way of doing this is required as
// the json serialization at the end does not serialize if // the json serialization at the end does not serialize if
// you just pass in a models.Attachmentable // you just pass in a models.Attachmentable
convertedAttachments := []map[string]interface{}{} convertedAttachments := []map[string]any{}
for _, attachment := range attachments { for _, attachment := range attachments {
am, err := parseableToMap(attachment) am, err := parseableToMap(attachment)

View File

@ -221,7 +221,7 @@ func (suite *MailAPIIntgSuite) SetupSuite() {
suite.user = tester.M365UserID(t) suite.user = tester.M365UserID(t)
} }
func getJSONObject(t *testing.T, thing serialization.Parsable) map[string]interface{} { func getJSONObject(t *testing.T, thing serialization.Parsable) map[string]any {
sw := kjson.NewJsonSerializationWriter() sw := kjson.NewJsonSerializationWriter()
err := sw.WriteObjectValue("", thing) err := sw.WriteObjectValue("", thing)
@ -230,7 +230,7 @@ func getJSONObject(t *testing.T, thing serialization.Parsable) map[string]interf
content, err := sw.GetSerializedContent() content, err := sw.GetSerializedContent()
require.NoError(t, err, "serialize") require.NoError(t, err, "serialize")
var out map[string]interface{} var out map[string]any
err = json.Unmarshal([]byte(content), &out) err = json.Unmarshal([]byte(content), &out)
require.NoError(t, err, "unmarshall") require.NoError(t, err, "unmarshall")