github-vet / github-vet/rangeloop-pointer-findings
Tencent/bk-cmdb: src/source_controller/coreservice/core/model/classification.go; 33 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Tencent/bk-cmdb](https://www.github.com/Tencent/bk-cmdb) at [src/source_controller/coreservice/core/model/classification.go](https://github.com/Tencent/bk-cmdb/blob/4347923164dc5bdd2ecd166e58d00c5a394b5c10/src/source_controller/coreservice/core/model/classification.go#L76-L108)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
>
[Click here to see the code in its original context.](https://github.com/Tencent/bk-cmdb/blob/4347923164dc5bdd2ecd166e58d00c5a394b5c10/src/source_controller/coreservice/core/model/classification.go#L76-L108)
Click here to show the 33 line(s) of Go which triggered the analyzer.
```go
for itemIdx, item := range inputParam.Data {
if 0 == len(item.ClassificationID) {
blog.Errorf("request(%s): it is failed to create the model classification, because of the classificationID (%#v) is not set", kit.Rid, item.ClassificationID)
addExceptionFunc(int64(itemIdx), kit.CCError.Errorf(common.CCErrCommParamsNeedSet, metadata.ClassFieldClassificationID).(errors.CCErrorCoder), &item)
continue
}
_, exists, err := m.isExists(kit, item.ClassificationID)
if nil != err {
blog.Errorf("request(%s): it is failed to check the classification ID (%s) is exists, error info is %s", kit.Rid, item.ClassificationID, err.Error())
addExceptionFunc(int64(itemIdx), err.(errors.CCErrorCoder), &item)
continue
}
if exists {
dataResult.Repeated = append(dataResult.Repeated, metadata.RepeatedDataResult{OriginIndex: int64(itemIdx), Data: mapstr.NewFromStruct(item, "field")})
continue
}
item.OwnerID = kit.SupplierAccount
id, err := m.save(kit, item)
if nil != err {
blog.Errorf("request(%s): it is failed to save the classification(%#v), error info is %s", kit.Rid, item, err.Error())
addExceptionFunc(int64(itemIdx), err.(errors.CCErrorCoder), &item)
continue
}
dataResult.Created = append(dataResult.Created, metadata.CreatedDataResult{
ID: id,
})
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {addExceptionFunc 3} was not found in the callgraph; reference was passed directly to third-party code
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 4347923164dc5bdd2ecd166e58d00c5a394b5c10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.