func (cfg *Config) Validate() error {
	i, err := strconv.Atoi(cfg.Port)
	if err != nil {
		return ErrInvalidPort
	}
	if i <= 0 || i > 65535 {
		return ErrInvalidPort
	}
	return nil
}
Validate the config parsed into the Config struct
package webgo
import (
	"encoding/json"
	"io/ioutil"
	"strconv"
	"time"
)
type Config struct {
	Host string `json:"host,omitempty"`
	Port string `json:"port,omitempty"`
	CertFile string `json:"certFile,omitempty"`
	KeyFile string `json:"keyFile,omitempty"`
	HTTPSPort string `json:"httpsPort,omitempty"`
	ReadTimeout time.Duration `json:"readTimeout,omitempty"`
	WriteTimeout time.Duration `json:"writeTimeout,omitempty"`
	InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
	ShutdownTimeout time.Duration
}
func (cfg *Config) Load(filepath string) {
	file, err := ioutil.ReadFile(filepath)
	if err != nil {
		LOGHANDLER.Fatal(err)
	}
	err = json.Unmarshal(file, cfg)
	if err != nil {
		LOGHANDLER.Fatal(err)
	}
	err = cfg.Validate()
	if err != nil {
		LOGHANDLER.Fatal(ErrInvalidPort)
	}
}