You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt""log""github.com/apple/foundationdb/bindings/go/src/fdb"
)
funcmain() {
fdb.MustAPIVersion(730)
// Open the default databasedb, err:=fdb.MustOpenDefault()
iferr!=nil {
log.Fatalf("Failed to open database: %v", err)
}
// Create keys for our testnameKey:= []byte("person:name")
ageKey:= []byte("person:age")
// Write some data in a transaction_, err=db.Transact(func(tr fdb.Transaction) (interface{}, error) {
fmt.Println("Setting values...")
tr.Set(nameKey, []byte("John Smith"))
tr.Set(ageKey, []byte("42"))
returnnil, nil
})
iferr!=nil {
log.Fatalf("Transaction failed: %v", err)
}
// Read data in a transactionresult, err:=db.Transact(func(tr fdb.Transaction) (interface{}, error) {
fmt.Println("Reading values...")
// Future represents a value that may not be ready yetnameFuture:=tr.Get(nameKey)
ageFuture:=tr.Get(ageKey)
// Wait for the futures to be ready and get their valuesname:=nameFuture.MustGet()
age:=ageFuture.MustGet()
// Return the resultsreturnmap[string][]byte{
"name": name,
"age": age,
}, nil
})
iferr!=nil {
log.Fatalf("Read transaction failed: %v", err)
}
// Type assertion to get our result mapdata:=result.(map[string][]byte)
// Print the resultsfmt.Printf("Name: %s\n", string(data["name"]))
fmt.Printf("Age: %s\n", string(data["age"]))
// Clear the data in a transaction_, err=db.Transact(func(tr fdb.Transaction) (interface{}, error) {
fmt.Println("Clearing values...")
tr.Clear(nameKey)
tr.Clear(ageKey)
returnnil, nil
})
iferr!=nil {
log.Fatalf("Clear transaction failed: %v", err)
}
fmt.Println("Data successfully written, read and cleared!")
}
What did you see happen?
When I tried to work with the package I noticed that there were a bunch of missing functions from my intellisense and I'd get errors such as undefined: fdb.MustAPIVersion (compiler UndeclaredImportedName)
When I'd go to look at the package in my go module cache <removed>/go/pkg/mod/github.com/apple/foundationdb/bindings/[email protected]/src/fdb/
I can see the missing functions but I have the following errors
No packages found for open file <removed>/go/pkg/mod/github.com/apple/foundationdb/bindings/[email protected]/src/fdb/fdb.go.
This file is ignored by your gopls build. (go list)
What did you expect to see?
I expected gopls to work and show these functions but for some reason it is ignoring them
I have no custom gopls config or build tags selected
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
Go version
go version go1.24.3 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I've been trying to work with the
github.com/apple/foundationdb/bindings/go/src/fdb
package that I loaded from Go modulesAll I've done was get the package from go modules
Then using a simple program tried to use it
What did you see happen?
When I tried to work with the package I noticed that there were a bunch of missing functions from my intellisense and I'd get errors such as
undefined: fdb.MustAPIVersion (compiler UndeclaredImportedName)
When I'd go to look at the package in my go module cache
<removed>/go/pkg/mod/github.com/apple/foundationdb/bindings/[email protected]/src/fdb/
I can see the missing functions but I have the following errors
What did you expect to see?
I expected gopls to work and show these functions but for some reason it is ignoring them
I have no custom gopls config or build tags selected
Edit:
I found the following issue under the vscode-go project which I added a comment too but it seems to be closed and I don't think has any triage
The text was updated successfully, but these errors were encountered: