Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Update the deprecated functions in Go feature server.
Signed-off-by: Shuchu Han <shuchu.han@gmail.com>
  • Loading branch information
shuchu committed Sep 24, 2025
commit c87ab2a925f302bdf4ea963b4eff43aec6e17cd4
2 changes: 1 addition & 1 deletion go/infra/docker/feature-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.5
FROM golang:1.23.12

# Update the package list and install the ca-certificates package
RUN apt-get update && apt-get install -y ca-certificates
Expand Down
9 changes: 3 additions & 6 deletions go/internal/feast/model/featureview.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package model

import (
"slices"

durationpb "google.golang.org/protobuf/types/known/durationpb"

"github.com/feast-dev/feast/go/protos/feast/core"
Expand Down Expand Up @@ -66,10 +68,5 @@ func (fv *FeatureView) NewFeatureViewFromBase(base *BaseFeatureView) *FeatureVie
}

func (fv *FeatureView) HasEntity(name string) bool {
for _, entityName := range fv.EntityNames {
if entityName == name {
return true
}
}
return false
return slices.Contains(fv.EntityNames, name)
}
5 changes: 2 additions & 3 deletions go/internal/feast/registry/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package registry

import (
"github.com/google/uuid"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -33,7 +32,7 @@ func NewFileRegistryStore(config *RegistryConfig, repoPath string) *FileRegistry
// GetRegistryProto reads and parses the registry proto from the file path.
func (r *FileRegistryStore) GetRegistryProto() (*core.Registry, error) {
registry := &core.Registry{}
in, err := ioutil.ReadFile(r.filePath)
in, err := os.ReadFile(r.filePath)
if err != nil {
return nil, err
}
Expand All @@ -58,7 +57,7 @@ func (r *FileRegistryStore) writeRegistry(rp *core.Registry) error {
if err != nil {
return err
}
err = ioutil.WriteFile(r.filePath, bytes, 0644)
err = os.WriteFile(r.filePath, bytes, 0644)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go/internal/feast/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package registry
import (
"context"
"errors"
"io/ioutil"
"io"
"net/url"
"strings"
"testing"
Expand All @@ -16,7 +16,7 @@ func TestGetOnlineFeaturesS3Registry(t *testing.T) {
mockS3Client := &MockS3Client{
GetObjectFn: func(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) {
return &s3.GetObjectOutput{
Body: ioutil.NopCloser(strings.NewReader("mock data")),
Body: io.NopCloser(strings.NewReader("mock data")),
}, nil
},
DeleteObjectFn: func(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) {
Expand Down
4 changes: 2 additions & 2 deletions go/internal/feast/registry/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package registry
import (
"context"
"errors"
"io/ioutil"
"io"
"strings"
"time"

Expand Down Expand Up @@ -65,7 +65,7 @@ func (r *S3RegistryStore) GetRegistryProto() (*core.Registry, error) {
}
defer output.Body.Close()

data, err := ioutil.ReadAll(output.Body)
data, err := io.ReadAll(output.Body)
if err != nil {
return nil, err
}
Expand Down
11 changes: 6 additions & 5 deletions go/internal/feast/server/grpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package server

import (
"context"
"io/ioutil"
"net"
"os"
"path/filepath"
Expand All @@ -21,6 +20,7 @@ import (
"github.com/apache/arrow/go/v17/parquet/pqarrow"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"

"github.com/feast-dev/feast/go/internal/feast"
Expand Down Expand Up @@ -84,9 +84,9 @@ func getClient(ctx context.Context, offlineStoreType string, basePath string, lo
}
}()

conn, _ := grpc.DialContext(ctx, "", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
conn, _ := grpc.NewClient("passthrough:///bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
Comment thread
shuchu marked this conversation as resolved.
return listener.Dial()
}), grpc.WithInsecure())
}), grpc.WithTransportCredentials(insecure.NewCredentials()))

closer := func() {
listener.Close()
Expand Down Expand Up @@ -216,15 +216,16 @@ func TestGetOnlineFeaturesSqliteWithLogging(t *testing.T) {

// Wait for logger to flush.
require.Eventually(t, func() bool {
files, err := ioutil.ReadDir(logPath)
files, err := os.ReadDir(logPath)
if err != nil || len(files) == 0 {
return false
}
stat, err := os.Stat(filepath.Join(logPath, files[0].Name()))
return err == nil && stat.Size() > 0
}, 1*time.Second, 100*time.Millisecond)

files, err := ioutil.ReadDir(logPath)
files, err := os.ReadDir(logPath)
assert.Nil(t, err)
logFile := filepath.Join(logPath, files[0].Name())
pf, err := file.OpenParquetFile(logFile, false)
assert.Nil(t, err)
Expand Down
6 changes: 3 additions & 3 deletions go/internal/feast/server/logging/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package logging

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
Expand Down Expand Up @@ -114,11 +114,11 @@ func TestLogAndFlushToFile(t *testing.T) {
))

require.Eventually(t, func() bool {
files, _ := ioutil.ReadDir(sink.path)
files, _ := os.ReadDir(sink.path)
return len(files) > 0
}, 60*time.Second, 100*time.Millisecond)

files, _ := ioutil.ReadDir(sink.path)
files, _ := os.ReadDir(sink.path)

pf, err := file.OpenParquetFile(filepath.Join(sink.path, files[0].Name()), false)
assert.Nil(t, err)
Expand Down
3 changes: 1 addition & 2 deletions go/internal/feast/server/logging/offlinestoresink.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package logging
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -33,7 +32,7 @@ func (s *OfflineStoreSink) getOrCreateDatasetDir() (string, error) {
if s.datasetDir != "" {
return s.datasetDir, nil
}
dir, err := ioutil.TempDir("", "*")
dir, err := os.MkdirTemp("", "*")
if err != nil {
return "", err
}
Expand Down