...

Source file src/github.com/coreos/go-systemd/v22/unit/section.go

Documentation: github.com/coreos/go-systemd/v22/unit

     1  // Copyright 2020 CoreOS, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package unit
    16  
    17  // UnitEntry is a single line entry in a Unit file.
    18  type UnitEntry struct {
    19  	Name  string
    20  	Value string
    21  }
    22  
    23  // UnitSection is a section in a Unit file. The section name
    24  // and a list of entries in that section.
    25  type UnitSection struct {
    26  	Section string
    27  	Entries []*UnitEntry
    28  }
    29  
    30  // String implements the stringify interface for UnitEntry
    31  func (u *UnitEntry) String() string {
    32  	return "{Name: " + u.Name + ", " + "Value: " + u.Value + "}"
    33  }
    34  
    35  // String implements the stringify interface for UnitSection
    36  func (s *UnitSection) String() string {
    37  	result := "{Section: " + s.Section
    38  	for _, e := range s.Entries {
    39  		result += e.String()
    40  	}
    41  
    42  	result += "}"
    43  	return result
    44  }
    45  

View as plain text