feat: if .venv python not found ues system python (#2404)

This commit is contained in:
Ryo
2025-10-29 14:07:49 +08:00
committed by GitHub
parent 5f11c49733
commit 984b0acba9
4 changed files with 11 additions and 4 deletions

View File

@ -40,5 +40,10 @@ func GetPython3Path() string {
return ".venv/bin/python3"
}
return filepath.Join(cwd, ".venv/bin/python3")
filePath := filepath.Join(cwd, ".venv/bin/python3")
if _, err := os.Stat(filePath); err == nil {
return filePath
}
return "python3" // use system python3
}

View File

@ -33,7 +33,7 @@ require (
github.com/cloudwego/hertz v0.10.2
github.com/dimchansky/utfbom v1.1.1
github.com/elastic/go-elasticsearch/v7 v7.17.10
github.com/elastic/go-elasticsearch/v8 v8.18.0
github.com/elastic/go-elasticsearch/v8 v8.19.0
github.com/extrame/xls v0.0.1
github.com/getkin/kin-openapi v0.118.0
github.com/go-resty/resty/v2 v2.16.5

View File

@ -343,6 +343,8 @@ github.com/elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxx
github.com/elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4=
github.com/elastic/go-elasticsearch/v8 v8.18.0 h1:ANNq1h7DEiPUaALb8+5w3baQzaS08WfHV0DNzp0VG4M=
github.com/elastic/go-elasticsearch/v8 v8.18.0/go.mod h1:WLqwXsJmQoYkoA9JBFeEwPkQhCfAZuUvfpdU/NvSSf0=
github.com/elastic/go-elasticsearch/v8 v8.19.0 h1:VmfBLNRORY7RZL+9hTxBD97ehl9H8Nxf2QigDh6HuMU=
github.com/elastic/go-elasticsearch/v8 v8.19.0/go.mod h1:F3j9e+BubmKvzvLjNui/1++nJuJxbkhHefbaT0kFKGY=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=

View File

@ -243,8 +243,8 @@ func (c *es8Client) CreateIndex(ctx context.Context, index string, properties ma
Properties: propertiesMap,
},
Settings: &types.IndexSettings{
NumberOfShards: getEnvDefaultIntSetting("ES_NUMBER_OF_SHARDS", "1"),
NumberOfReplicas: getEnvDefaultIntSetting("ES_NUMBER_OF_REPLICAS", "1"),
NumberOfShards: ptr.Of(getEnvDefaultIntSetting("ES_NUMBER_OF_SHARDS", "1")),
NumberOfReplicas: ptr.Of(getEnvDefaultIntSetting("ES_NUMBER_OF_REPLICAS", "1")),
},
}).Do(ctx); err != nil {
return err