title: Checking if string from golang file exists in yaml file
body: <p>I am rather new to working with yaml and golang. Currently, I am creating a golang program that parses an rpm package to check for subsystem dependencies. It extends the <a href="https://github.com/sassoftware/go-rpmutils" rel="nofollow noreferrer">go-rpmutils library</a>. </p>
  
  <p>So far this is the code I have within my main function to handle conditions:</p>
  
  <pre><code>func main() {
      // Parse the rpm
      rpm, err := rpmutils.ReadRpm("file.rpm")
      if err != nil {
          panic(err)
      }
  
      // Get RPM Deps
      dependencies, err := rpm.Header.GetStrings(rpmutils.REQUIRENAME)
      if err != nil {
          panic(err)
      }
  
      // Check for specific dep condition
      for _, p := range dependencies {
          if strings.HasPrefix(p, "prefix1") &amp;&amp; p != "string-including-prefix1" {
              fmt.Printf("\t%s\n", p)
              defer os.Exit(1)
          }
      }
  }
  </code></pre>
  
  <p>I am able to output the dependencies but want to set up several if else conditions for when specific subsystem dependencies exist. </p>
  
  <p>In a separate yaml file, I have:</p>
  
  <pre><code>allowed-deps:
      -dep1
      -dep2
      -dep3
  
  third-party-deps:
      -dep4
      -dep5
      -dep6
  
  internal-deps:
      -dep7
      -dep8
      -dep9
  </code></pre>
  
  <p>I'd like to compare the value of var p from the for loop with the values in the yaml file. So for example:</p>
  
  <ul>
  <li>if p only equals values from allowed-deps, print "successfully built rpm" and do not prompt os.Exit(1)</li>
  <li>if p equals any of the third-party-deps, print "err msg for third-party deps" and os.Exit(1)</li>
  <li>if p equals any internal-deps, print "another err mssg" and os.Exit(1)</li>
  </ul>
  
  <p>How can I go about doing this?</p>