Commit b3de3b98 authored by songlinfeng's avatar songlinfeng 💬
Browse files

add main

parent baa6f330
Pipeline #3057 failed with stages
in 0 seconds
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
<option name="ckgOperationStatus" value="SUCCESS" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/k8s-device-plugin.iml" filepath="$PROJECT_DIR$/.idea/k8s-device-plugin.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
package main
import (
"fmt"
"k8s-device-plugin/internal/pkg/hwloc"
"os"
)
var gitDescribe string
type ResourceNamingStrategy string
const (
StrategySingle ResourceNamingStrategy = "single"
StrategyMixed ResourceNamingStrategy = "mixed"
)
func ParseStrategy(s string) (ResourceNamingStrategy, error) {
switch s {
case string(StrategySingle):
return StrategySingle, nil
case string(StrategyMixed):
return StrategyMixed, nil
default:
return "", fmt.Errorf("invalid strategy: %s", s)
}
}
func main() {
versions := [...]string{
"DCU device plugin for Kubernetes",
fmt.Sprintf("%s version %s", os.Args[0], gitDescribe),
fmt.Sprintf("%s", hwloc.GetVersions()),
}
for _, v := range versions {
fmt.Println(v)
}
}
module k8s-device-plugin
go 1.25.3
package hwloc
// #cgo pkg-config: hwloc
// #include <stdint.h>
// #include <hwloc.h>
import "C"
import (
"fmt"
)
func GetVersions() string {
return fmt.Sprintf("hwloc: _VERSION: %s, _API_VERSION: %#08x, _COMPONENT_ABI: %d, Runtime: %#08x",
C.HWLOC_VERSION,
C.HWLOC_API_VERSION,
C.HWLOC_COMPONENT_ABI,
uint(C.hwloc_get_api_version()))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment