Your Question

Is there a way to declare a default value for slice like this?

type SoftwareComponent struct {
    Id             int                      `json:"id"`
    Name           string                   `json:"name"`
    Version        string                   `json:"version"`
    Licenses       dbtypes.StringSlice      `gorm:"default:['UNKNOWN']"`    // <-----  ???
}

Remark: dbtypes.StringSlice is []string with implemented Value() (driver.Value, error) and Scan(val interface{}) error

The document you expected this should be explained

Expected answer

Comment From: a631807682

duplicated of https://github.com/go-gorm/gorm/issues/5529