Dev terraform provider 基于新框架tpf开发 开发示例: https://github.com/hashicorp/terraform-provider-scaffolding-framework https://github.com/serialt/terraform-provider-demo 参考示例: https://github.com/hashicorp/terraform-provider-hashicups 一、调试 provider 1、debug terraform # makefile default: install build: go build -v ./... install: go install -v ./... vscode 调试 terraform provider 1)vscode launch cat .vscode/launch.json {
VSCode Extension Pack vscode扩展包 在使用vscode的时候,需要安装各种各类的插件来满足不同的功能,在新安装vscode或者切换其他机器的时候,会因为
go plugin [serialt@Krab plugin]🐳 tree . . ├── go.mod ├── kk │ ├── kk.go │ └── kk.so ├── ks └── main.go // kk.go package main import "fmt" func Greet(name string) { fmt.Println("Hello", name) } func main() {} // main.go package main import ( "log" "plugin" ) func main() { p, err
Simple Gin package main import ( "fmt" "log/slog" "net/http" "time" "github.com/gin-gonic/gin" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) type msg struct { Count int64 `json:"count"` } var pingCounter = prometheus.NewCounter( prometheus.CounterOpts{ Name: "ping_request_count", Help: "No of request handled by Ping handler", }, ) var httpReqs = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "http_requests_total", Help: "How many HTTP requests processed, partitioned by status code and HTTP method.", }, []string{"code", "method"}, ) func PromHandler(handler http.Handler) gin.HandlerFunc { return func(c
Exporter 开发 Prometheus Exporter是一个用来收集和暴露指标数据的工具,通过与Prometheus监控系统一起使用。它的结构包括两个组件:Collect
Go Wire wire是 Google 开源的一个依赖注入工具。它是一个代码生成器,并不是一个框架。我们只需要在一个特殊的go文件中告诉wire类型之间的依赖关系,