Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 14, 2025

The SDK upgrade changed DeleteResource from accepting a string to requiring a *Resource object, breaking the build.

Changes

  • Updated DeleteFileFromStorage in service/oss.go to construct a Resource object for the new API
  • Set Name field to the filePath; Owner field left empty for SDK auto-fill
// Before
affected, err := casdoorsdk.DeleteResource(filePath)

// After  
resource := &casdoorsdk.Resource{
    Name: filePath,
}
affected, err := casdoorsdk.DeleteResource(resource)

The SDK implementation automatically populates empty Owner fields with the configured organization name, avoiding circular dependency issues between service and object packages.

Original prompt

This section details on the original issue you should resolve

<issue_title>[bug] fix the bugs after uprading casdoor-go-sdk to v0.40.0</issue_title>
<issue_description>after uprading casdoor-go-sdk to v0.40.0 in commit: 2267b8a

it causes the error in CI: https://github.com/casdoor/casnode/actions/runs/20212324513/job/58020005887

Run go build -race -ldflags "-extldflags '-static'"
  go build -race -ldflags "-extldflags '-static'"
  shell: /usr/bin/bash -e {0}
go: downloading github.com/astaxie/beego v1.12.3
go: downloading github.com/casdoor/casdoor-go-sdk v0.40.0
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading xorm.io/core v0.7.2
go: downloading xorm.io/xorm v0.8.1
go: downloading github.com/casbin/google-groups-crawler v0.1.3
go: downloading github.com/gomarkdown/markdown v0.0.0-20210408062403-ad838ccf8cdd
go: downloading github.com/microcosm-cc/bluemonday v1.0.5
go: downloading github.com/mileusna/crontab v1.0.1
go: downloading github.com/sromku/go-gitter v0.0.0-20170828210750-70f7030a94a6
go: downloading golang.org/x/net v0.16.0
go: downloading github.com/chromedp/chromedp v0.13.2
go: downloading github.com/huichen/sego v0.0.0-20180617034105-3f3c8a8cfacc
go: downloading github.com/mozillazg/go-slugify v0.2.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/prometheus/client_golang v1.11.0
go: downloading golang.org/x/crypto v0.14.0
go: downloading github.com/gomodule/redigo v2.0.0+incompatible
go: downloading github.com/golang-jwt/jwt/v4 v4.5.0
go: downloading github.com/google/uuid v1.6.0
go: downloading golang.org/x/oauth2 v0.13.0
go: downloading github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18
go: downloading xorm.io/builder v0.3.6
go: downloading github.com/chris-ramon/douceur v0.2.0
go: downloading github.com/mreiferson/go-httpclient v0.0.0-20201222173833-5e475fde3a4d
go: downloading github.com/mrexodia/wray v0.0.0-20160318003008-78a2c1f284ff
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/chromedp/cdproto v0.0.0-20250319231242-a755498943c8
go: downloading github.com/go-json-experiment/json v0.0.0-20250211171154-1ae217ad3535
go: downloading github.com/gobwas/ws v1.4.0
go: downloading github.com/mozillazg/go-unidecode v0.1.1
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/common v0.26.0
go: downloading github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading github.com/gorilla/css v1.0.0
go: downloading github.com/chromedp/sysutil v1.1.0
go: downloading github.com/gobwas/httphead v0.1.0
go: downloading github.com/gobwas/pool v0.2.1
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/prometheus/procfs v0.6.0
go: downloading golang.org/x/text v0.13.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading google.golang.org/protobuf v1.31.0
go: downloading golang.org/x/sys v0.29.0
# github.com/casbin/casnode/service
Error: service/oss.go:50:45: cannot use filePath (variable of type string) as *casdoorsdk.Resource value in argument to casdoorsdk.DeleteResource
Error: Process completed with exit code 1.
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hsluoyz hsluoyz marked this pull request as ready for review December 14, 2025 18:37
Copilot AI and others added 2 commits December 14, 2025 18:44
… v0.40.0

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bugs after upgrading casdoor-go-sdk to v0.40.0 Fix DeleteResource API call for casdoor-go-sdk v0.40.0 Dec 14, 2025
Copilot AI requested a review from hsluoyz December 14, 2025 18:48
@hsluoyz hsluoyz closed this Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] fix the bugs after uprading casdoor-go-sdk to v0.40.0

3 participants