github.com/drone/runner-go@v1.12.0/internal/merge.go (about)

     1  // Copyright 2019 Drone.IO Inc. All rights reserved.
     2  // Use of this source code is governed by the Polyform License
     3  // that can be found in the LICENSE file.
     4  
     5  package internal
     6  
     7  import "github.com/drone/drone-go/drone"
     8  
     9  // MergeStage merges the source stage with the destination.
    10  func MergeStage(src, dst *drone.Stage) {
    11  	dst.Version = src.Version
    12  	dst.Created = src.Created
    13  	dst.Updated = src.Updated
    14  	for i, src := range src.Steps {
    15  		dst := dst.Steps[i]
    16  		MergeStep(src, dst)
    17  	}
    18  }
    19  
    20  // MergeStep merges the source stage with the destination.
    21  func MergeStep(src, dst *drone.Step) {
    22  	dst.Version = src.Version
    23  	dst.ID = src.ID
    24  	dst.StageID = src.StageID
    25  	dst.Started = src.Started
    26  	dst.Stopped = src.Stopped
    27  	dst.Version = src.Version
    28  	dst.Schema = src.Schema
    29  }