mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-11 20:45:32 +08:00
Chore: tidy for go 1.20 (#902)
Tidy code for Go 1.20 and update Go version for Docker and CI --------- Co-authored-by: Kory Prince <korylprince@gmail.com>
This commit is contained in:
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
name: Build, test, and format
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.16.x, 1.17.x]
|
||||
go-version: [1.18.x, 1.19.x, 1.20.x]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
## [Unreleased](https://github.com/micromdm/micromdm/compare/v1.11.0...main)
|
||||
|
||||
- Add `-log-time` flag to include timestamps in log messages (#890)
|
||||
- Add `-device-signature-skew` flag to allow configuring clock skew when verifying device signatures (#887)
|
||||
- Tidy code for Go 1.20, and update Go version for Docker and CI
|
||||
- Project dependency updates (#888, #889, #900)
|
||||
|
||||
Thanks to our contributors: @jamesez, @korylprince
|
||||
|
||||
## [v1.11.0](https://github.com/micromdm/micromdm/compare/v1.10.1...v1.11.0)
|
||||
|
||||
This release includes new features and fixes.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.17 as builder
|
||||
FROM golang:1.20 as builder
|
||||
|
||||
WORKDIR /go/src/github.com/micromdm/micromdm/
|
||||
|
||||
|
||||
@@ -100,8 +100,9 @@ Examples:
|
||||
# Apply a DEP Profile.
|
||||
mdmctl apply dep-profiles -f /path/to/dep-profile.json
|
||||
|
||||
|
||||
`
|
||||
fmt.Println(applyUsage)
|
||||
fmt.Print(applyUsage)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -296,8 +297,8 @@ func (cmd *applyCommand) applyProfile(args []string) error {
|
||||
)
|
||||
flagset.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "%s\n",
|
||||
`Upload profiles to the server.
|
||||
|
||||
`Upload profiles to the server.
|
||||
|
||||
Uploaded profiles can also be specified in a blueprint, which will be applied on device enrollment.
|
||||
This command can also be used to replace the enrollment profile.
|
||||
Profiles can be signed before upload.
|
||||
|
||||
@@ -24,7 +24,7 @@ func (cmd *applyCommand) applyDEPAutoAssigner(args []string) error {
|
||||
return errors.New("bad input: must provide both -filter and -uuid")
|
||||
}
|
||||
|
||||
assigner := sync.AutoAssigner{*flFilter, *flProfileUUID}
|
||||
assigner := sync.AutoAssigner{Filter: *flFilter, ProfileUUID: *flProfileUUID}
|
||||
|
||||
err := cmd.depsyncsvc.ApplyAutoAssigner(context.TODO(), &assigner)
|
||||
if err != nil {
|
||||
|
||||
@@ -79,8 +79,9 @@ func (cmd *configCommand) Usage() error {
|
||||
mdmctl config print
|
||||
mdmctl config set -h
|
||||
mdmctl config switch -h
|
||||
|
||||
`
|
||||
fmt.Println(help)
|
||||
fmt.Print(help)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ func migrateServerConfig(configName string) error {
|
||||
var serverCfg *ServerConfig
|
||||
err = json.Unmarshal(cfgData, &serverCfg)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to unmarshal %s", configPath)
|
||||
return fmt.Errorf("failed to unmarshal %s: %w", configPath, err)
|
||||
}
|
||||
if err = saveServerConfig(serverCfg, configName); err != nil {
|
||||
return err
|
||||
@@ -116,13 +117,10 @@ func migrateServerConfig(configName string) error {
|
||||
if err = os.Remove(configPath); err != nil {
|
||||
return err
|
||||
}
|
||||
err = switchServerConfig(configName)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed to set %s as active config", configName)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to set %s as active config", configName)
|
||||
}
|
||||
if err = switchServerConfig(configName); err != nil {
|
||||
return fmt.Errorf("failed to set %s as active config: %w", configName, err)
|
||||
}
|
||||
|
||||
fmt.Println("Successfully migrated old config.")
|
||||
return nil
|
||||
}
|
||||
@@ -309,8 +307,7 @@ func LoadServerConfig() (*ServerConfig, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var serverCfg ServerConfig
|
||||
serverCfg = cfg.Servers[cfg.Active]
|
||||
var serverCfg ServerConfig = cfg.Servers[cfg.Active]
|
||||
return &serverCfg, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -103,8 +103,9 @@ Examples:
|
||||
|
||||
# Get a device by serial (TODO implement filtering)
|
||||
mdmctl get devices -serials=C02ABCDEF
|
||||
|
||||
`
|
||||
fmt.Println(getUsage)
|
||||
fmt.Print(getUsage)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ func (out *depProfilesTableOutput) BasicFooter() {
|
||||
out.w.Flush()
|
||||
}
|
||||
|
||||
const noUUIDText = `The DEP API does not support listing profiles.
|
||||
const noUUIDText = `The DEP API does not support listing profiles.
|
||||
A UUID flag must be specified. To get currently assigned profile UUIDs run
|
||||
mdmctl get dep-devices -serials=serial1,serial2,serial3
|
||||
The output of the dep-devices response will contain the profile UUIDs.
|
||||
|
||||
`
|
||||
|
||||
func (cmd *getCommand) getDEPProfiles(args []string) error {
|
||||
@@ -38,7 +39,7 @@ func (cmd *getCommand) getDEPProfiles(args []string) error {
|
||||
}
|
||||
|
||||
if *flUUID == "" {
|
||||
fmt.Println(noUUIDText)
|
||||
fmt.Printf(noUUIDText)
|
||||
flagset.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -72,8 +72,9 @@ Upload this file to https://identity.apple.com and download the signed
|
||||
certificate. Then use the 'mdmctl mdmcert upload' command to upload it,
|
||||
(and the above private key) into MicroMDM.
|
||||
|
||||
|
||||
`
|
||||
fmt.Println(usageText)
|
||||
fmt.Print(usageText)
|
||||
return nil
|
||||
|
||||
}
|
||||
@@ -279,7 +280,7 @@ func sendMdmcertDownloadRequest(client *http.Client, req *http.Request) error {
|
||||
return err
|
||||
}
|
||||
if jsn.Result != "success" {
|
||||
return fmt.Errorf("got unexpected result body: %q\n", jsn.Result)
|
||||
return fmt.Errorf("got unexpected result body: %q", jsn.Result)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -60,8 +60,9 @@ Commands:
|
||||
vendor
|
||||
push
|
||||
upload
|
||||
|
||||
`
|
||||
fmt.Println(usageText)
|
||||
fmt.Print(usageText)
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
@@ -69,8 +69,9 @@ Valid resource types:
|
||||
* profiles
|
||||
* block
|
||||
* dep-autoassigner
|
||||
|
||||
`
|
||||
|
||||
fmt.Println(getUsage)
|
||||
fmt.Print(getUsage)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user