From e325e947b1de55224bc3e92b181337d4fa65ce79 Mon Sep 17 00:00:00 2001 From: Zenkie Bear Date: Fri, 8 Mar 2024 14:16:33 +0800 Subject: [PATCH] fix: Updated the module name If the module is released at major version 2 or higher, the module path must end with a major version suffix like /v2. Refer to https://go.dev/ref/mod --- ca.go | 6 +- cert/cert.go | 4 +- docs/docs.go | 85 ++--------------------------- docs/swagger.json | 80 +-------------------------- docs/swagger.yaml | 59 -------------------- example_test.go | 2 +- go.mod | 2 +- goca.go | 2 +- key/key.go | 2 +- rest-api/controllers/controllers.go | 8 +-- rest-api/main.go | 4 +- rest-api/models/models.go | 2 +- 12 files changed, 21 insertions(+), 235 deletions(-) diff --git a/ca.go b/ca.go index f36e831..baebb18 100644 --- a/ca.go +++ b/ca.go @@ -12,9 +12,9 @@ import ( "path/filepath" "time" - storage "github.com/kairoaraujo/goca/_storage" - "github.com/kairoaraujo/goca/cert" - "github.com/kairoaraujo/goca/key" + storage "github.com/kairoaraujo/goca/v2/_storage" + "github.com/kairoaraujo/goca/v2/cert" + "github.com/kairoaraujo/goca/v2/key" ) // Const diff --git a/cert/cert.go b/cert/cert.go index 2c23f3d..2bcb16c 100644 --- a/cert/cert.go +++ b/cert/cert.go @@ -43,8 +43,8 @@ import ( "path/filepath" "time" - storage "github.com/kairoaraujo/goca/_storage" - "github.com/kairoaraujo/goca/key" + storage "github.com/kairoaraujo/goca/v2/_storage" + "github.com/kairoaraujo/goca/v2/key" ) const ( diff --git a/docs/docs.go b/docs/docs.go index 56bdfb2..8130a59 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Package docs GENERATED BY SWAG; DO NOT EDIT -// This file was generated by swaggo/swag +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -428,67 +427,6 @@ const docTemplate = `{ } } }, - "goca.Identity": { - "type": "object", - "properties": { - "country": { - "description": "Country (two letters)", - "type": "string", - "example": "NL" - }, - "dns_names": { - "description": "DNS Names list", - "type": "array", - "items": { - "type": "string" - }, - "example": [ - "ca.example.com", - "root-ca.example.com" - ] - }, - "email": { - "description": "Email Address", - "type": "string", - "example": "sec@company.com" - }, - "intermediate": { - "description": "Intermendiate Certificate Authority (default is false)", - "type": "boolean", - "example": false - }, - "key_size": { - "description": "Key Bit Size (defaul: 2048)", - "type": "integer", - "example": 2048 - }, - "locality": { - "description": "Locality name", - "type": "string", - "example": "Noord-Brabant" - }, - "organization": { - "description": "Organization name", - "type": "string", - "example": "Company" - }, - "organization_unit": { - "description": "Organizational Unit name", - "type": "string", - "example": "Security Management" - }, - "province": { - "description": "Province name", - "type": "string", - "example": "Veldhoven" - }, - "valid": { - "description": "Minimum 1 day, maximum 825 days -- Default: 397", - "type": "integer", - "example": 365 - } - } - }, "models.CABody": { "type": "object", "properties": { @@ -589,24 +527,7 @@ const docTemplate = `{ } }, "models.Payload": { - "type": "object", - "required": [ - "common_name", - "identity" - ], - "properties": { - "common_name": { - "type": "string", - "example": "root-ca" - }, - "identity": { - "$ref": "#/definitions/goca.Identity" - }, - "parent_common_name": { - "type": "string", - "example": "root-ca" - } - } + "type": "object" }, "models.ResponseCA": { "type": "object", @@ -667,6 +588,8 @@ var SwaggerInfo = &swag.Spec{ Description: "GoCA Certificate Authority Management API.", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index dc7b0ec..f466f9b 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -422,67 +422,6 @@ } } }, - "goca.Identity": { - "type": "object", - "properties": { - "country": { - "description": "Country (two letters)", - "type": "string", - "example": "NL" - }, - "dns_names": { - "description": "DNS Names list", - "type": "array", - "items": { - "type": "string" - }, - "example": [ - "ca.example.com", - "root-ca.example.com" - ] - }, - "email": { - "description": "Email Address", - "type": "string", - "example": "sec@company.com" - }, - "intermediate": { - "description": "Intermendiate Certificate Authority (default is false)", - "type": "boolean", - "example": false - }, - "key_size": { - "description": "Key Bit Size (defaul: 2048)", - "type": "integer", - "example": 2048 - }, - "locality": { - "description": "Locality name", - "type": "string", - "example": "Noord-Brabant" - }, - "organization": { - "description": "Organization name", - "type": "string", - "example": "Company" - }, - "organization_unit": { - "description": "Organizational Unit name", - "type": "string", - "example": "Security Management" - }, - "province": { - "description": "Province name", - "type": "string", - "example": "Veldhoven" - }, - "valid": { - "description": "Minimum 1 day, maximum 825 days -- Default: 397", - "type": "integer", - "example": 365 - } - } - }, "models.CABody": { "type": "object", "properties": { @@ -583,24 +522,7 @@ } }, "models.Payload": { - "type": "object", - "required": [ - "common_name", - "identity" - ], - "properties": { - "common_name": { - "type": "string", - "example": "root-ca" - }, - "identity": { - "$ref": "#/definitions/goca.Identity" - }, - "parent_common_name": { - "type": "string", - "example": "root-ca" - } - } + "type": "object" }, "models.ResponseCA": { "type": "object", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 291d554..805b5e1 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -57,53 +57,6 @@ definitions: -----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY----- type: string type: object - goca.Identity: - properties: - country: - description: Country (two letters) - example: NL - type: string - dns_names: - description: DNS Names list - example: - - ca.example.com - - root-ca.example.com - items: - type: string - type: array - email: - description: Email Address - example: sec@company.com - type: string - intermediate: - description: Intermendiate Certificate Authority (default is false) - example: false - type: boolean - key_size: - description: 'Key Bit Size (defaul: 2048)' - example: 2048 - type: integer - locality: - description: Locality name - example: Noord-Brabant - type: string - organization: - description: Organization name - example: Company - type: string - organization_unit: - description: Organizational Unit name - example: Security Management - type: string - province: - description: Province name - example: Veldhoven - type: string - valid: - description: 'Minimum 1 day, maximum 825 days -- Default: 397' - example: 365 - type: integer - type: object models.CABody: properties: certificates: @@ -175,18 +128,6 @@ definitions: type: string type: object models.Payload: - properties: - common_name: - example: root-ca - type: string - identity: - $ref: '#/definitions/goca.Identity' - parent_common_name: - example: root-ca - type: string - required: - - common_name - - identity type: object models.ResponseCA: properties: diff --git a/example_test.go b/example_test.go index 6fabf1c..f3e579e 100644 --- a/example_test.go +++ b/example_test.go @@ -5,7 +5,7 @@ import ( "log" "os" - "github.com/kairoaraujo/goca" + "github.com/kairoaraujo/goca/v2" ) func Example_minimal() { diff --git a/go.mod b/go.mod index 5afdff8..2f5c1da 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/kairoaraujo/goca +module github.com/kairoaraujo/goca/v2 go 1.21 diff --git a/goca.go b/goca.go index 83a4cb6..1e14a58 100644 --- a/goca.go +++ b/goca.go @@ -20,7 +20,7 @@ import ( "crypto/rsa" "crypto/x509" - storage "github.com/kairoaraujo/goca/_storage" + storage "github.com/kairoaraujo/goca/v2/_storage" ) // CA represents the basic CA data diff --git a/key/key.go b/key/key.go index 87d3cb2..e5ed2b7 100644 --- a/key/key.go +++ b/key/key.go @@ -35,7 +35,7 @@ import ( "crypto/x509" "encoding/pem" - storage "github.com/kairoaraujo/goca/_storage" + storage "github.com/kairoaraujo/goca/v2/_storage" ) // KeysData represents the RSA keys with Private Key (Key) and Public Key (Public Key). diff --git a/rest-api/controllers/controllers.go b/rest-api/controllers/controllers.go index 2a68107..3a337c8 100644 --- a/rest-api/controllers/controllers.go +++ b/rest-api/controllers/controllers.go @@ -11,10 +11,10 @@ import ( "github.com/gin-gonic/gin" "github.com/google/uuid" - "github.com/kairoaraujo/goca" - storage "github.com/kairoaraujo/goca/_storage" - "github.com/kairoaraujo/goca/cert" - "github.com/kairoaraujo/goca/rest-api/models" + "github.com/kairoaraujo/goca/v2" + storage "github.com/kairoaraujo/goca/v2/_storage" + "github.com/kairoaraujo/goca/v2/cert" + "github.com/kairoaraujo/goca/v2/rest-api/models" ) func getCAData(ca goca.CA) (body models.CABody) { diff --git a/rest-api/main.go b/rest-api/main.go index 20bcf45..af6e1ee 100644 --- a/rest-api/main.go +++ b/rest-api/main.go @@ -8,8 +8,8 @@ import ( swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" - _ "github.com/kairoaraujo/goca/docs" - "github.com/kairoaraujo/goca/rest-api/controllers" + _ "github.com/kairoaraujo/goca/v2/docs" + "github.com/kairoaraujo/goca/v2/rest-api/controllers" ) // @title GoCA API diff --git a/rest-api/models/models.go b/rest-api/models/models.go index 8f5ff76..1b5589b 100644 --- a/rest-api/models/models.go +++ b/rest-api/models/models.go @@ -1,7 +1,7 @@ package models import ( - "github.com/kairoaraujo/goca" + "github.com/kairoaraujo/goca/v2" ) type ResponseError struct {