This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 0b616606ae docs(bindings/go): document CodeUnsupported for list 
options (#9349)
0b616606ae is described below

commit 0b616606ae26df48f1981a52b94be4d4e1f31e8f
Author: Xuanwo <[email protected]>
AuthorDate: Sun Nov 29 14:16:55 2026 +0800

    docs(bindings/go): document CodeUnsupported for list options (#9349)
    
    docs(bindings/go): name the error code for unsupported list options
    
    Refs #9334
---
 bindings/go/options.go        |  2 +-
 dev/src/generate/c/options.rs | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/bindings/go/options.go b/bindings/go/options.go
index 7cedbbf65e..15c01576c2 100644
--- a/bindings/go/options.go
+++ b/bindings/go/options.go
@@ -31,7 +31,7 @@ import (
 // - Pagination: `ListWithLimit`, `ListWithStartAfter`.
 // - Versioning: `ListWithVersions`, `ListWithDeleted`.
 //
-// The operation fails with `crate::ErrorKind::Unsupported` when an option
+// The operation fails with an `*Error` whose `Code()` is `CodeUnsupported` 
when an option
 // requires a capability that the operator lacks.
 type WithListFn func(*listOptions)
 
diff --git a/dev/src/generate/c/options.rs b/dev/src/generate/c/options.rs
index 96fce73b82..e7670d3ac0 100644
--- a/dev/src/generate/c/options.rs
+++ b/dev/src/generate/c/options.rs
@@ -253,6 +253,12 @@ fn options_model(
         let purpose = first.strip_prefix("Options for ").unwrap_or(first);
         *first = format!("With{go_prefix}Fn is a functional option for 
{purpose}");
     }
+    for line in &mut go_fn_doc {
+        *line = line.replace(
+            "`crate::ErrorKind::Unsupported`",
+            "an `*Error` whose `Code()` is `CodeUnsupported`",
+        );
+    }
 
     Ok(OptionsModel {
         conversion: conversion(core, &fields)?,
@@ -561,6 +567,13 @@ mod tests {
         ));
         assert!(go.contains("// - Pagination: `ListWithLimit`, 
`ListWithStartAfter`.\n"));
         assert!(go.contains("// Setting this requires 
`Capability.ListWithStartAfter`.\n"));
+        let list_doc = doc_above(&go, "//", "type WithListFn ");
+        assert!(
+            list_doc
+                .iter()
+                .any(|line| line.contains("`*Error` whose `Code()` is 
`CodeUnsupported`")),
+            "Go WithListFn docs: {list_doc:?}"
+        );
 
         // Every option or capability that the docs name exists in the
         // generated C header and Go capability.

Reply via email to