Skip to content

Commit bf78cf2

Browse files
committed
Remove unused SupportLevel database field
`db.Library.SupportLevel` was not filled for any library in the database and there is no use of this field's value by any Arduino software. Since the index field has the `omitempty` tag, it was never marshalled when generating the `library_index.json` filethat is the consumed output from the database. Although it's not clear what the intended purpose was for this field, the `Types` field of the database's releases does provide some indication of a support level. For example the "Arduino" type is used for official libraries, meaning they are directly supported by Arduino. The "Retired" type would indicate it is no longer supported. The "Contributed" type is used for 3rd party libraries submitted to the Library Manager index, indicating that direct support is the responsibility of the 3rd party library maintainer. Since the field is not used and there are no current plans for its use nor even recollection of what the plan was at the time it was added, it only adds unnecessary complexity to the code. It is best to remove it. There will be no impact on the public API. We can always add an equivalent field back if we later determine that it would be useful to record more information about a library's support level than is already contained in the `Type` field.
1 parent cd44376 commit bf78cf2

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

internal/libraries/db/db.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ type DB struct {
4343

4444
// Library is an Arduino library
4545
type Library struct {
46-
Name string
47-
Repository string
48-
SupportLevel string
46+
Name string
47+
Repository string
4948

5049
// Category of the latest release of the library
5150
LatestCategory string

internal/libraries/db/db_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,16 @@ func testerDB() *DB {
3434
tDB := DB{
3535
Libraries: []*Library{
3636
{
37-
Name: "FooLib",
38-
Repository: "https://github.com/Bar/FooLib.git",
39-
SupportLevel: "",
37+
Name: "FooLib",
38+
Repository: "https://github.com/Bar/FooLib.git",
4039
},
4140
{
42-
Name: "BazLib",
43-
Repository: "https://github.com/Bar/BazLib.git",
44-
SupportLevel: "",
41+
Name: "BazLib",
42+
Repository: "https://github.com/Bar/BazLib.git",
4543
},
4644
{
47-
Name: "QuxLib",
48-
Repository: "https://github.com/Zeb/QuxLib.git",
49-
SupportLevel: "",
45+
Name: "QuxLib",
46+
Repository: "https://github.com/Zeb/QuxLib.git",
5047
},
5148
},
5249
Releases: []*Release{

internal/libraries/db/index.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ type indexLibrary struct {
4848
ArchiveFileName string `json:"archiveFileName"`
4949
Size int64 `json:"size"`
5050
Checksum string `json:"checksum"`
51-
52-
SupportLevel string `json:"supportLevel,omitempty"`
5351
}
5452

5553
type indexDependency struct {
@@ -96,7 +94,6 @@ func (db *DB) OutputLibraryIndex() (interface{}, error) {
9694
URL: libraryRelease.URL,
9795
Size: libraryRelease.Size,
9896
Checksum: libraryRelease.Checksum,
99-
SupportLevel: lib.SupportLevel,
10097
Repository: lib.Repository,
10198
ProvidesIncludes: libraryRelease.Includes,
10299
Dependencies: deps,

tests/testdata/test_sync/golden/db.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
{
44
"Name": "SpacebrewYun",
55
"Repository": "https://github.com/arduino-libraries/SpacebrewYun.git",
6-
"SupportLevel": "",
76
"LatestCategory": "Communication"
87
},
98
{
109
"Name": "ArduinoCloudThing",
1110
"Repository": "https://github.com/arduino-libraries/ArduinoCloudThing.git",
12-
"SupportLevel": "",
1311
"LatestCategory": "Communication"
1412
}
1513
],

0 commit comments

Comments
 (0)