code: func (d *VaultAgentTokenQuery) watch(lastStat os.FileInfo) <-chan *watchResult {
  	ch := make(chan *watchResult, 1)
  
  	go func(lastStat os.FileInfo) {
  		for {
  			stat, err := os.Stat(d.path)
  			if err != nil {
  				select {
  				case <-d.stopCh:
  					return
  				case ch <- &watchResult{err: err}:
  					return
  				}
  			}
  
  			changed := lastStat == nil ||
  				lastStat.Size() != stat.Size() ||
  				lastStat.ModTime() != stat.ModTime()
  
  			if changed {
  				select {
  				case <-d.stopCh:
  					return
  				case ch <- &watchResult{stat: stat}:
  					return
  				}
  			}
  
  			time.Sleep(VaultAgentTokenSleepTime)
  		}
  	}(lastStat)
  
  	return ch
  }
docs: // watch watches the file for changes