github.com/cdoern/storage@v1.12.13/pkg/archive/archive_ffjson.go (about)

     1  // Code generated by ffjson <https://github.com/pquerna/ffjson>. DO NOT EDIT.
     2  // source: pkg/archive/archive.go
     3  
     4  package archive
     5  
     6  import (
     7  	"bytes"
     8  	"encoding/json"
     9  	"errors"
    10  	"fmt"
    11  	"github.com/containers/storage/pkg/idtools"
    12  	fflib "github.com/pquerna/ffjson/fflib/v1"
    13  )
    14  
    15  // MarshalJSON marshal bytes to json - template
    16  func (j *Archiver) MarshalJSON() ([]byte, error) {
    17  	var buf fflib.Buffer
    18  	if j == nil {
    19  		buf.WriteString("null")
    20  		return buf.Bytes(), nil
    21  	}
    22  	err := j.MarshalJSONBuf(&buf)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  	return buf.Bytes(), nil
    27  }
    28  
    29  // MarshalJSONBuf marshal buff to json - template
    30  func (j *Archiver) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
    31  	if j == nil {
    32  		buf.WriteString("null")
    33  		return nil
    34  	}
    35  	var err error
    36  	var obj []byte
    37  	_ = obj
    38  	_ = err
    39  	buf.WriteString(`{"Untar":`)
    40  	/* Falling back. type=func(io.Reader, string, *archive.TarOptions) error kind=func */
    41  	err = buf.Encode(j.Untar)
    42  	if err != nil {
    43  		return err
    44  	}
    45  	if j.TarIDMappings != nil {
    46  		/* Struct fall back. type=idtools.IDMappings kind=struct */
    47  		buf.WriteString(`,"TarIDMappings":`)
    48  		err = buf.Encode(j.TarIDMappings)
    49  		if err != nil {
    50  			return err
    51  		}
    52  	} else {
    53  		buf.WriteString(`,"TarIDMappings":null`)
    54  	}
    55  	if j.ChownOpts != nil {
    56  		/* Struct fall back. type=idtools.IDPair kind=struct */
    57  		buf.WriteString(`,"ChownOpts":`)
    58  		err = buf.Encode(j.ChownOpts)
    59  		if err != nil {
    60  			return err
    61  		}
    62  	} else {
    63  		buf.WriteString(`,"ChownOpts":null`)
    64  	}
    65  	if j.UntarIDMappings != nil {
    66  		/* Struct fall back. type=idtools.IDMappings kind=struct */
    67  		buf.WriteString(`,"UntarIDMappings":`)
    68  		err = buf.Encode(j.UntarIDMappings)
    69  		if err != nil {
    70  			return err
    71  		}
    72  	} else {
    73  		buf.WriteString(`,"UntarIDMappings":null`)
    74  	}
    75  	buf.WriteByte('}')
    76  	return nil
    77  }
    78  
    79  const (
    80  	ffjtArchiverbase = iota
    81  	ffjtArchivernosuchkey
    82  
    83  	ffjtArchiverUntar
    84  
    85  	ffjtArchiverTarIDMappings
    86  
    87  	ffjtArchiverChownOpts
    88  
    89  	ffjtArchiverUntarIDMappings
    90  )
    91  
    92  var ffjKeyArchiverUntar = []byte("Untar")
    93  
    94  var ffjKeyArchiverTarIDMappings = []byte("TarIDMappings")
    95  
    96  var ffjKeyArchiverChownOpts = []byte("ChownOpts")
    97  
    98  var ffjKeyArchiverUntarIDMappings = []byte("UntarIDMappings")
    99  
   100  // UnmarshalJSON umarshall json - template of ffjson
   101  func (j *Archiver) UnmarshalJSON(input []byte) error {
   102  	fs := fflib.NewFFLexer(input)
   103  	return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
   104  }
   105  
   106  // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
   107  func (j *Archiver) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
   108  	var err error
   109  	currentKey := ffjtArchiverbase
   110  	_ = currentKey
   111  	tok := fflib.FFTok_init
   112  	wantedTok := fflib.FFTok_init
   113  
   114  mainparse:
   115  	for {
   116  		tok = fs.Scan()
   117  		//	println(fmt.Sprintf("debug: tok: %v  state: %v", tok, state))
   118  		if tok == fflib.FFTok_error {
   119  			goto tokerror
   120  		}
   121  
   122  		switch state {
   123  
   124  		case fflib.FFParse_map_start:
   125  			if tok != fflib.FFTok_left_bracket {
   126  				wantedTok = fflib.FFTok_left_bracket
   127  				goto wrongtokenerror
   128  			}
   129  			state = fflib.FFParse_want_key
   130  			continue
   131  
   132  		case fflib.FFParse_after_value:
   133  			if tok == fflib.FFTok_comma {
   134  				state = fflib.FFParse_want_key
   135  			} else if tok == fflib.FFTok_right_bracket {
   136  				goto done
   137  			} else {
   138  				wantedTok = fflib.FFTok_comma
   139  				goto wrongtokenerror
   140  			}
   141  
   142  		case fflib.FFParse_want_key:
   143  			// json {} ended. goto exit. woo.
   144  			if tok == fflib.FFTok_right_bracket {
   145  				goto done
   146  			}
   147  			if tok != fflib.FFTok_string {
   148  				wantedTok = fflib.FFTok_string
   149  				goto wrongtokenerror
   150  			}
   151  
   152  			kn := fs.Output.Bytes()
   153  			if len(kn) <= 0 {
   154  				// "" case. hrm.
   155  				currentKey = ffjtArchivernosuchkey
   156  				state = fflib.FFParse_want_colon
   157  				goto mainparse
   158  			} else {
   159  				switch kn[0] {
   160  
   161  				case 'C':
   162  
   163  					if bytes.Equal(ffjKeyArchiverChownOpts, kn) {
   164  						currentKey = ffjtArchiverChownOpts
   165  						state = fflib.FFParse_want_colon
   166  						goto mainparse
   167  					}
   168  
   169  				case 'T':
   170  
   171  					if bytes.Equal(ffjKeyArchiverTarIDMappings, kn) {
   172  						currentKey = ffjtArchiverTarIDMappings
   173  						state = fflib.FFParse_want_colon
   174  						goto mainparse
   175  					}
   176  
   177  				case 'U':
   178  
   179  					if bytes.Equal(ffjKeyArchiverUntar, kn) {
   180  						currentKey = ffjtArchiverUntar
   181  						state = fflib.FFParse_want_colon
   182  						goto mainparse
   183  
   184  					} else if bytes.Equal(ffjKeyArchiverUntarIDMappings, kn) {
   185  						currentKey = ffjtArchiverUntarIDMappings
   186  						state = fflib.FFParse_want_colon
   187  						goto mainparse
   188  					}
   189  
   190  				}
   191  
   192  				if fflib.EqualFoldRight(ffjKeyArchiverUntarIDMappings, kn) {
   193  					currentKey = ffjtArchiverUntarIDMappings
   194  					state = fflib.FFParse_want_colon
   195  					goto mainparse
   196  				}
   197  
   198  				if fflib.EqualFoldRight(ffjKeyArchiverChownOpts, kn) {
   199  					currentKey = ffjtArchiverChownOpts
   200  					state = fflib.FFParse_want_colon
   201  					goto mainparse
   202  				}
   203  
   204  				if fflib.EqualFoldRight(ffjKeyArchiverTarIDMappings, kn) {
   205  					currentKey = ffjtArchiverTarIDMappings
   206  					state = fflib.FFParse_want_colon
   207  					goto mainparse
   208  				}
   209  
   210  				if fflib.SimpleLetterEqualFold(ffjKeyArchiverUntar, kn) {
   211  					currentKey = ffjtArchiverUntar
   212  					state = fflib.FFParse_want_colon
   213  					goto mainparse
   214  				}
   215  
   216  				currentKey = ffjtArchivernosuchkey
   217  				state = fflib.FFParse_want_colon
   218  				goto mainparse
   219  			}
   220  
   221  		case fflib.FFParse_want_colon:
   222  			if tok != fflib.FFTok_colon {
   223  				wantedTok = fflib.FFTok_colon
   224  				goto wrongtokenerror
   225  			}
   226  			state = fflib.FFParse_want_value
   227  			continue
   228  		case fflib.FFParse_want_value:
   229  
   230  			if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
   231  				switch currentKey {
   232  
   233  				case ffjtArchiverUntar:
   234  					goto handle_Untar
   235  
   236  				case ffjtArchiverTarIDMappings:
   237  					goto handle_TarIDMappings
   238  
   239  				case ffjtArchiverChownOpts:
   240  					goto handle_ChownOpts
   241  
   242  				case ffjtArchiverUntarIDMappings:
   243  					goto handle_UntarIDMappings
   244  
   245  				case ffjtArchivernosuchkey:
   246  					err = fs.SkipField(tok)
   247  					if err != nil {
   248  						return fs.WrapErr(err)
   249  					}
   250  					state = fflib.FFParse_after_value
   251  					goto mainparse
   252  				}
   253  			} else {
   254  				goto wantedvalue
   255  			}
   256  		}
   257  	}
   258  
   259  handle_Untar:
   260  
   261  	/* handler: j.Untar type=func(io.Reader, string, *archive.TarOptions) error kind=func quoted=false*/
   262  
   263  	{
   264  		/* Falling back. type=func(io.Reader, string, *archive.TarOptions) error kind=func */
   265  		tbuf, err := fs.CaptureField(tok)
   266  		if err != nil {
   267  			return fs.WrapErr(err)
   268  		}
   269  
   270  		err = json.Unmarshal(tbuf, &j.Untar)
   271  		if err != nil {
   272  			return fs.WrapErr(err)
   273  		}
   274  	}
   275  
   276  	state = fflib.FFParse_after_value
   277  	goto mainparse
   278  
   279  handle_TarIDMappings:
   280  
   281  	/* handler: j.TarIDMappings type=idtools.IDMappings kind=struct quoted=false*/
   282  
   283  	{
   284  		/* Falling back. type=idtools.IDMappings kind=struct */
   285  		tbuf, err := fs.CaptureField(tok)
   286  		if err != nil {
   287  			return fs.WrapErr(err)
   288  		}
   289  
   290  		err = json.Unmarshal(tbuf, &j.TarIDMappings)
   291  		if err != nil {
   292  			return fs.WrapErr(err)
   293  		}
   294  	}
   295  
   296  	state = fflib.FFParse_after_value
   297  	goto mainparse
   298  
   299  handle_ChownOpts:
   300  
   301  	/* handler: j.ChownOpts type=idtools.IDPair kind=struct quoted=false*/
   302  
   303  	{
   304  		/* Falling back. type=idtools.IDPair kind=struct */
   305  		tbuf, err := fs.CaptureField(tok)
   306  		if err != nil {
   307  			return fs.WrapErr(err)
   308  		}
   309  
   310  		err = json.Unmarshal(tbuf, &j.ChownOpts)
   311  		if err != nil {
   312  			return fs.WrapErr(err)
   313  		}
   314  	}
   315  
   316  	state = fflib.FFParse_after_value
   317  	goto mainparse
   318  
   319  handle_UntarIDMappings:
   320  
   321  	/* handler: j.UntarIDMappings type=idtools.IDMappings kind=struct quoted=false*/
   322  
   323  	{
   324  		/* Falling back. type=idtools.IDMappings kind=struct */
   325  		tbuf, err := fs.CaptureField(tok)
   326  		if err != nil {
   327  			return fs.WrapErr(err)
   328  		}
   329  
   330  		err = json.Unmarshal(tbuf, &j.UntarIDMappings)
   331  		if err != nil {
   332  			return fs.WrapErr(err)
   333  		}
   334  	}
   335  
   336  	state = fflib.FFParse_after_value
   337  	goto mainparse
   338  
   339  wantedvalue:
   340  	return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
   341  wrongtokenerror:
   342  	return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
   343  tokerror:
   344  	if fs.BigError != nil {
   345  		return fs.WrapErr(fs.BigError)
   346  	}
   347  	err = fs.Error.ToError()
   348  	if err != nil {
   349  		return fs.WrapErr(err)
   350  	}
   351  	panic("ffjson-generated: unreachable, please report bug.")
   352  done:
   353  
   354  	return nil
   355  }
   356  
   357  // MarshalJSON marshal bytes to json - template
   358  func (j *TarOptions) MarshalJSON() ([]byte, error) {
   359  	var buf fflib.Buffer
   360  	if j == nil {
   361  		buf.WriteString("null")
   362  		return buf.Bytes(), nil
   363  	}
   364  	err := j.MarshalJSONBuf(&buf)
   365  	if err != nil {
   366  		return nil, err
   367  	}
   368  	return buf.Bytes(), nil
   369  }
   370  
   371  // MarshalJSONBuf marshal buff to json - template
   372  func (j *TarOptions) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
   373  	if j == nil {
   374  		buf.WriteString("null")
   375  		return nil
   376  	}
   377  	var err error
   378  	var obj []byte
   379  	_ = obj
   380  	_ = err
   381  	buf.WriteString(`{"IncludeFiles":`)
   382  	if j.IncludeFiles != nil {
   383  		buf.WriteString(`[`)
   384  		for i, v := range j.IncludeFiles {
   385  			if i != 0 {
   386  				buf.WriteString(`,`)
   387  			}
   388  			fflib.WriteJsonString(buf, string(v))
   389  		}
   390  		buf.WriteString(`]`)
   391  	} else {
   392  		buf.WriteString(`null`)
   393  	}
   394  	buf.WriteString(`,"ExcludePatterns":`)
   395  	if j.ExcludePatterns != nil {
   396  		buf.WriteString(`[`)
   397  		for i, v := range j.ExcludePatterns {
   398  			if i != 0 {
   399  				buf.WriteString(`,`)
   400  			}
   401  			fflib.WriteJsonString(buf, string(v))
   402  		}
   403  		buf.WriteString(`]`)
   404  	} else {
   405  		buf.WriteString(`null`)
   406  	}
   407  	buf.WriteString(`,"Compression":`)
   408  	fflib.FormatBits2(buf, uint64(j.Compression), 10, j.Compression < 0)
   409  	if j.NoLchown {
   410  		buf.WriteString(`,"NoLchown":true`)
   411  	} else {
   412  		buf.WriteString(`,"NoLchown":false`)
   413  	}
   414  	buf.WriteString(`,"UIDMaps":`)
   415  	if j.UIDMaps != nil {
   416  		buf.WriteString(`[`)
   417  		for i, v := range j.UIDMaps {
   418  			if i != 0 {
   419  				buf.WriteString(`,`)
   420  			}
   421  			/* Struct fall back. type=idtools.IDMap kind=struct */
   422  			err = buf.Encode(&v)
   423  			if err != nil {
   424  				return err
   425  			}
   426  		}
   427  		buf.WriteString(`]`)
   428  	} else {
   429  		buf.WriteString(`null`)
   430  	}
   431  	buf.WriteString(`,"GIDMaps":`)
   432  	if j.GIDMaps != nil {
   433  		buf.WriteString(`[`)
   434  		for i, v := range j.GIDMaps {
   435  			if i != 0 {
   436  				buf.WriteString(`,`)
   437  			}
   438  			/* Struct fall back. type=idtools.IDMap kind=struct */
   439  			err = buf.Encode(&v)
   440  			if err != nil {
   441  				return err
   442  			}
   443  		}
   444  		buf.WriteString(`]`)
   445  	} else {
   446  		buf.WriteString(`null`)
   447  	}
   448  	if j.ChownOpts != nil {
   449  		/* Struct fall back. type=idtools.IDPair kind=struct */
   450  		buf.WriteString(`,"ChownOpts":`)
   451  		err = buf.Encode(j.ChownOpts)
   452  		if err != nil {
   453  			return err
   454  		}
   455  	} else {
   456  		buf.WriteString(`,"ChownOpts":null`)
   457  	}
   458  	if j.IncludeSourceDir {
   459  		buf.WriteString(`,"IncludeSourceDir":true`)
   460  	} else {
   461  		buf.WriteString(`,"IncludeSourceDir":false`)
   462  	}
   463  	buf.WriteString(`,"WhiteoutFormat":`)
   464  	fflib.FormatBits2(buf, uint64(j.WhiteoutFormat), 10, j.WhiteoutFormat < 0)
   465  	buf.WriteString(`,"WhiteoutData":`)
   466  	/* Interface types must use runtime reflection. type=interface {} kind=interface */
   467  	err = buf.Encode(j.WhiteoutData)
   468  	if err != nil {
   469  		return err
   470  	}
   471  	if j.NoOverwriteDirNonDir {
   472  		buf.WriteString(`,"NoOverwriteDirNonDir":true`)
   473  	} else {
   474  		buf.WriteString(`,"NoOverwriteDirNonDir":false`)
   475  	}
   476  	if j.RebaseNames == nil {
   477  		buf.WriteString(`,"RebaseNames":null`)
   478  	} else {
   479  		buf.WriteString(`,"RebaseNames":{ `)
   480  		for key, value := range j.RebaseNames {
   481  			fflib.WriteJsonString(buf, key)
   482  			buf.WriteString(`:`)
   483  			fflib.WriteJsonString(buf, string(value))
   484  			buf.WriteByte(',')
   485  		}
   486  		buf.Rewind(1)
   487  		buf.WriteByte('}')
   488  	}
   489  	if j.InUserNS {
   490  		buf.WriteString(`,"InUserNS":true`)
   491  	} else {
   492  		buf.WriteString(`,"InUserNS":false`)
   493  	}
   494  	if j.CopyPass {
   495  		buf.WriteString(`,"CopyPass":true`)
   496  	} else {
   497  		buf.WriteString(`,"CopyPass":false`)
   498  	}
   499  	buf.WriteByte('}')
   500  	return nil
   501  }
   502  
   503  const (
   504  	ffjtTarOptionsbase = iota
   505  	ffjtTarOptionsnosuchkey
   506  
   507  	ffjtTarOptionsIncludeFiles
   508  
   509  	ffjtTarOptionsExcludePatterns
   510  
   511  	ffjtTarOptionsCompression
   512  
   513  	ffjtTarOptionsNoLchown
   514  
   515  	ffjtTarOptionsUIDMaps
   516  
   517  	ffjtTarOptionsGIDMaps
   518  
   519  	ffjtTarOptionsChownOpts
   520  
   521  	ffjtTarOptionsIncludeSourceDir
   522  
   523  	ffjtTarOptionsWhiteoutFormat
   524  
   525  	ffjtTarOptionsWhiteoutData
   526  
   527  	ffjtTarOptionsNoOverwriteDirNonDir
   528  
   529  	ffjtTarOptionsRebaseNames
   530  
   531  	ffjtTarOptionsInUserNS
   532  
   533  	ffjtTarOptionsCopyPass
   534  )
   535  
   536  var ffjKeyTarOptionsIncludeFiles = []byte("IncludeFiles")
   537  
   538  var ffjKeyTarOptionsExcludePatterns = []byte("ExcludePatterns")
   539  
   540  var ffjKeyTarOptionsCompression = []byte("Compression")
   541  
   542  var ffjKeyTarOptionsNoLchown = []byte("NoLchown")
   543  
   544  var ffjKeyTarOptionsUIDMaps = []byte("UIDMaps")
   545  
   546  var ffjKeyTarOptionsGIDMaps = []byte("GIDMaps")
   547  
   548  var ffjKeyTarOptionsChownOpts = []byte("ChownOpts")
   549  
   550  var ffjKeyTarOptionsIncludeSourceDir = []byte("IncludeSourceDir")
   551  
   552  var ffjKeyTarOptionsWhiteoutFormat = []byte("WhiteoutFormat")
   553  
   554  var ffjKeyTarOptionsWhiteoutData = []byte("WhiteoutData")
   555  
   556  var ffjKeyTarOptionsNoOverwriteDirNonDir = []byte("NoOverwriteDirNonDir")
   557  
   558  var ffjKeyTarOptionsRebaseNames = []byte("RebaseNames")
   559  
   560  var ffjKeyTarOptionsInUserNS = []byte("InUserNS")
   561  
   562  var ffjKeyTarOptionsCopyPass = []byte("CopyPass")
   563  
   564  // UnmarshalJSON umarshall json - template of ffjson
   565  func (j *TarOptions) UnmarshalJSON(input []byte) error {
   566  	fs := fflib.NewFFLexer(input)
   567  	return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
   568  }
   569  
   570  // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
   571  func (j *TarOptions) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
   572  	var err error
   573  	currentKey := ffjtTarOptionsbase
   574  	_ = currentKey
   575  	tok := fflib.FFTok_init
   576  	wantedTok := fflib.FFTok_init
   577  
   578  mainparse:
   579  	for {
   580  		tok = fs.Scan()
   581  		//	println(fmt.Sprintf("debug: tok: %v  state: %v", tok, state))
   582  		if tok == fflib.FFTok_error {
   583  			goto tokerror
   584  		}
   585  
   586  		switch state {
   587  
   588  		case fflib.FFParse_map_start:
   589  			if tok != fflib.FFTok_left_bracket {
   590  				wantedTok = fflib.FFTok_left_bracket
   591  				goto wrongtokenerror
   592  			}
   593  			state = fflib.FFParse_want_key
   594  			continue
   595  
   596  		case fflib.FFParse_after_value:
   597  			if tok == fflib.FFTok_comma {
   598  				state = fflib.FFParse_want_key
   599  			} else if tok == fflib.FFTok_right_bracket {
   600  				goto done
   601  			} else {
   602  				wantedTok = fflib.FFTok_comma
   603  				goto wrongtokenerror
   604  			}
   605  
   606  		case fflib.FFParse_want_key:
   607  			// json {} ended. goto exit. woo.
   608  			if tok == fflib.FFTok_right_bracket {
   609  				goto done
   610  			}
   611  			if tok != fflib.FFTok_string {
   612  				wantedTok = fflib.FFTok_string
   613  				goto wrongtokenerror
   614  			}
   615  
   616  			kn := fs.Output.Bytes()
   617  			if len(kn) <= 0 {
   618  				// "" case. hrm.
   619  				currentKey = ffjtTarOptionsnosuchkey
   620  				state = fflib.FFParse_want_colon
   621  				goto mainparse
   622  			} else {
   623  				switch kn[0] {
   624  
   625  				case 'C':
   626  
   627  					if bytes.Equal(ffjKeyTarOptionsCompression, kn) {
   628  						currentKey = ffjtTarOptionsCompression
   629  						state = fflib.FFParse_want_colon
   630  						goto mainparse
   631  
   632  					} else if bytes.Equal(ffjKeyTarOptionsChownOpts, kn) {
   633  						currentKey = ffjtTarOptionsChownOpts
   634  						state = fflib.FFParse_want_colon
   635  						goto mainparse
   636  
   637  					} else if bytes.Equal(ffjKeyTarOptionsCopyPass, kn) {
   638  						currentKey = ffjtTarOptionsCopyPass
   639  						state = fflib.FFParse_want_colon
   640  						goto mainparse
   641  					}
   642  
   643  				case 'E':
   644  
   645  					if bytes.Equal(ffjKeyTarOptionsExcludePatterns, kn) {
   646  						currentKey = ffjtTarOptionsExcludePatterns
   647  						state = fflib.FFParse_want_colon
   648  						goto mainparse
   649  					}
   650  
   651  				case 'G':
   652  
   653  					if bytes.Equal(ffjKeyTarOptionsGIDMaps, kn) {
   654  						currentKey = ffjtTarOptionsGIDMaps
   655  						state = fflib.FFParse_want_colon
   656  						goto mainparse
   657  					}
   658  
   659  				case 'I':
   660  
   661  					if bytes.Equal(ffjKeyTarOptionsIncludeFiles, kn) {
   662  						currentKey = ffjtTarOptionsIncludeFiles
   663  						state = fflib.FFParse_want_colon
   664  						goto mainparse
   665  
   666  					} else if bytes.Equal(ffjKeyTarOptionsIncludeSourceDir, kn) {
   667  						currentKey = ffjtTarOptionsIncludeSourceDir
   668  						state = fflib.FFParse_want_colon
   669  						goto mainparse
   670  
   671  					} else if bytes.Equal(ffjKeyTarOptionsInUserNS, kn) {
   672  						currentKey = ffjtTarOptionsInUserNS
   673  						state = fflib.FFParse_want_colon
   674  						goto mainparse
   675  					}
   676  
   677  				case 'N':
   678  
   679  					if bytes.Equal(ffjKeyTarOptionsNoLchown, kn) {
   680  						currentKey = ffjtTarOptionsNoLchown
   681  						state = fflib.FFParse_want_colon
   682  						goto mainparse
   683  
   684  					} else if bytes.Equal(ffjKeyTarOptionsNoOverwriteDirNonDir, kn) {
   685  						currentKey = ffjtTarOptionsNoOverwriteDirNonDir
   686  						state = fflib.FFParse_want_colon
   687  						goto mainparse
   688  					}
   689  
   690  				case 'R':
   691  
   692  					if bytes.Equal(ffjKeyTarOptionsRebaseNames, kn) {
   693  						currentKey = ffjtTarOptionsRebaseNames
   694  						state = fflib.FFParse_want_colon
   695  						goto mainparse
   696  					}
   697  
   698  				case 'U':
   699  
   700  					if bytes.Equal(ffjKeyTarOptionsUIDMaps, kn) {
   701  						currentKey = ffjtTarOptionsUIDMaps
   702  						state = fflib.FFParse_want_colon
   703  						goto mainparse
   704  					}
   705  
   706  				case 'W':
   707  
   708  					if bytes.Equal(ffjKeyTarOptionsWhiteoutFormat, kn) {
   709  						currentKey = ffjtTarOptionsWhiteoutFormat
   710  						state = fflib.FFParse_want_colon
   711  						goto mainparse
   712  
   713  					} else if bytes.Equal(ffjKeyTarOptionsWhiteoutData, kn) {
   714  						currentKey = ffjtTarOptionsWhiteoutData
   715  						state = fflib.FFParse_want_colon
   716  						goto mainparse
   717  					}
   718  
   719  				}
   720  
   721  				if fflib.EqualFoldRight(ffjKeyTarOptionsCopyPass, kn) {
   722  					currentKey = ffjtTarOptionsCopyPass
   723  					state = fflib.FFParse_want_colon
   724  					goto mainparse
   725  				}
   726  
   727  				if fflib.EqualFoldRight(ffjKeyTarOptionsInUserNS, kn) {
   728  					currentKey = ffjtTarOptionsInUserNS
   729  					state = fflib.FFParse_want_colon
   730  					goto mainparse
   731  				}
   732  
   733  				if fflib.EqualFoldRight(ffjKeyTarOptionsRebaseNames, kn) {
   734  					currentKey = ffjtTarOptionsRebaseNames
   735  					state = fflib.FFParse_want_colon
   736  					goto mainparse
   737  				}
   738  
   739  				if fflib.SimpleLetterEqualFold(ffjKeyTarOptionsNoOverwriteDirNonDir, kn) {
   740  					currentKey = ffjtTarOptionsNoOverwriteDirNonDir
   741  					state = fflib.FFParse_want_colon
   742  					goto mainparse
   743  				}
   744  
   745  				if fflib.SimpleLetterEqualFold(ffjKeyTarOptionsWhiteoutData, kn) {
   746  					currentKey = ffjtTarOptionsWhiteoutData
   747  					state = fflib.FFParse_want_colon
   748  					goto mainparse
   749  				}
   750  
   751  				if fflib.SimpleLetterEqualFold(ffjKeyTarOptionsWhiteoutFormat, kn) {
   752  					currentKey = ffjtTarOptionsWhiteoutFormat
   753  					state = fflib.FFParse_want_colon
   754  					goto mainparse
   755  				}
   756  
   757  				if fflib.EqualFoldRight(ffjKeyTarOptionsIncludeSourceDir, kn) {
   758  					currentKey = ffjtTarOptionsIncludeSourceDir
   759  					state = fflib.FFParse_want_colon
   760  					goto mainparse
   761  				}
   762  
   763  				if fflib.EqualFoldRight(ffjKeyTarOptionsChownOpts, kn) {
   764  					currentKey = ffjtTarOptionsChownOpts
   765  					state = fflib.FFParse_want_colon
   766  					goto mainparse
   767  				}
   768  
   769  				if fflib.EqualFoldRight(ffjKeyTarOptionsGIDMaps, kn) {
   770  					currentKey = ffjtTarOptionsGIDMaps
   771  					state = fflib.FFParse_want_colon
   772  					goto mainparse
   773  				}
   774  
   775  				if fflib.EqualFoldRight(ffjKeyTarOptionsUIDMaps, kn) {
   776  					currentKey = ffjtTarOptionsUIDMaps
   777  					state = fflib.FFParse_want_colon
   778  					goto mainparse
   779  				}
   780  
   781  				if fflib.SimpleLetterEqualFold(ffjKeyTarOptionsNoLchown, kn) {
   782  					currentKey = ffjtTarOptionsNoLchown
   783  					state = fflib.FFParse_want_colon
   784  					goto mainparse
   785  				}
   786  
   787  				if fflib.EqualFoldRight(ffjKeyTarOptionsCompression, kn) {
   788  					currentKey = ffjtTarOptionsCompression
   789  					state = fflib.FFParse_want_colon
   790  					goto mainparse
   791  				}
   792  
   793  				if fflib.EqualFoldRight(ffjKeyTarOptionsExcludePatterns, kn) {
   794  					currentKey = ffjtTarOptionsExcludePatterns
   795  					state = fflib.FFParse_want_colon
   796  					goto mainparse
   797  				}
   798  
   799  				if fflib.EqualFoldRight(ffjKeyTarOptionsIncludeFiles, kn) {
   800  					currentKey = ffjtTarOptionsIncludeFiles
   801  					state = fflib.FFParse_want_colon
   802  					goto mainparse
   803  				}
   804  
   805  				currentKey = ffjtTarOptionsnosuchkey
   806  				state = fflib.FFParse_want_colon
   807  				goto mainparse
   808  			}
   809  
   810  		case fflib.FFParse_want_colon:
   811  			if tok != fflib.FFTok_colon {
   812  				wantedTok = fflib.FFTok_colon
   813  				goto wrongtokenerror
   814  			}
   815  			state = fflib.FFParse_want_value
   816  			continue
   817  		case fflib.FFParse_want_value:
   818  
   819  			if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
   820  				switch currentKey {
   821  
   822  				case ffjtTarOptionsIncludeFiles:
   823  					goto handle_IncludeFiles
   824  
   825  				case ffjtTarOptionsExcludePatterns:
   826  					goto handle_ExcludePatterns
   827  
   828  				case ffjtTarOptionsCompression:
   829  					goto handle_Compression
   830  
   831  				case ffjtTarOptionsNoLchown:
   832  					goto handle_NoLchown
   833  
   834  				case ffjtTarOptionsUIDMaps:
   835  					goto handle_UIDMaps
   836  
   837  				case ffjtTarOptionsGIDMaps:
   838  					goto handle_GIDMaps
   839  
   840  				case ffjtTarOptionsChownOpts:
   841  					goto handle_ChownOpts
   842  
   843  				case ffjtTarOptionsIncludeSourceDir:
   844  					goto handle_IncludeSourceDir
   845  
   846  				case ffjtTarOptionsWhiteoutFormat:
   847  					goto handle_WhiteoutFormat
   848  
   849  				case ffjtTarOptionsWhiteoutData:
   850  					goto handle_WhiteoutData
   851  
   852  				case ffjtTarOptionsNoOverwriteDirNonDir:
   853  					goto handle_NoOverwriteDirNonDir
   854  
   855  				case ffjtTarOptionsRebaseNames:
   856  					goto handle_RebaseNames
   857  
   858  				case ffjtTarOptionsInUserNS:
   859  					goto handle_InUserNS
   860  
   861  				case ffjtTarOptionsCopyPass:
   862  					goto handle_CopyPass
   863  
   864  				case ffjtTarOptionsnosuchkey:
   865  					err = fs.SkipField(tok)
   866  					if err != nil {
   867  						return fs.WrapErr(err)
   868  					}
   869  					state = fflib.FFParse_after_value
   870  					goto mainparse
   871  				}
   872  			} else {
   873  				goto wantedvalue
   874  			}
   875  		}
   876  	}
   877  
   878  handle_IncludeFiles:
   879  
   880  	/* handler: j.IncludeFiles type=[]string kind=slice quoted=false*/
   881  
   882  	{
   883  
   884  		{
   885  			if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
   886  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
   887  			}
   888  		}
   889  
   890  		if tok == fflib.FFTok_null {
   891  			j.IncludeFiles = nil
   892  		} else {
   893  
   894  			j.IncludeFiles = []string{}
   895  
   896  			wantVal := true
   897  
   898  			for {
   899  
   900  				var tmpJIncludeFiles string
   901  
   902  				tok = fs.Scan()
   903  				if tok == fflib.FFTok_error {
   904  					goto tokerror
   905  				}
   906  				if tok == fflib.FFTok_right_brace {
   907  					break
   908  				}
   909  
   910  				if tok == fflib.FFTok_comma {
   911  					if wantVal == true {
   912  						// TODO(pquerna): this isn't an ideal error message, this handles
   913  						// things like [,,,] as an array value.
   914  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
   915  					}
   916  					continue
   917  				} else {
   918  					wantVal = true
   919  				}
   920  
   921  				/* handler: tmpJIncludeFiles type=string kind=string quoted=false*/
   922  
   923  				{
   924  
   925  					{
   926  						if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
   927  							return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
   928  						}
   929  					}
   930  
   931  					if tok == fflib.FFTok_null {
   932  
   933  					} else {
   934  
   935  						outBuf := fs.Output.Bytes()
   936  
   937  						tmpJIncludeFiles = string(string(outBuf))
   938  
   939  					}
   940  				}
   941  
   942  				j.IncludeFiles = append(j.IncludeFiles, tmpJIncludeFiles)
   943  
   944  				wantVal = false
   945  			}
   946  		}
   947  	}
   948  
   949  	state = fflib.FFParse_after_value
   950  	goto mainparse
   951  
   952  handle_ExcludePatterns:
   953  
   954  	/* handler: j.ExcludePatterns type=[]string kind=slice quoted=false*/
   955  
   956  	{
   957  
   958  		{
   959  			if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
   960  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
   961  			}
   962  		}
   963  
   964  		if tok == fflib.FFTok_null {
   965  			j.ExcludePatterns = nil
   966  		} else {
   967  
   968  			j.ExcludePatterns = []string{}
   969  
   970  			wantVal := true
   971  
   972  			for {
   973  
   974  				var tmpJExcludePatterns string
   975  
   976  				tok = fs.Scan()
   977  				if tok == fflib.FFTok_error {
   978  					goto tokerror
   979  				}
   980  				if tok == fflib.FFTok_right_brace {
   981  					break
   982  				}
   983  
   984  				if tok == fflib.FFTok_comma {
   985  					if wantVal == true {
   986  						// TODO(pquerna): this isn't an ideal error message, this handles
   987  						// things like [,,,] as an array value.
   988  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
   989  					}
   990  					continue
   991  				} else {
   992  					wantVal = true
   993  				}
   994  
   995  				/* handler: tmpJExcludePatterns type=string kind=string quoted=false*/
   996  
   997  				{
   998  
   999  					{
  1000  						if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
  1001  							return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
  1002  						}
  1003  					}
  1004  
  1005  					if tok == fflib.FFTok_null {
  1006  
  1007  					} else {
  1008  
  1009  						outBuf := fs.Output.Bytes()
  1010  
  1011  						tmpJExcludePatterns = string(string(outBuf))
  1012  
  1013  					}
  1014  				}
  1015  
  1016  				j.ExcludePatterns = append(j.ExcludePatterns, tmpJExcludePatterns)
  1017  
  1018  				wantVal = false
  1019  			}
  1020  		}
  1021  	}
  1022  
  1023  	state = fflib.FFParse_after_value
  1024  	goto mainparse
  1025  
  1026  handle_Compression:
  1027  
  1028  	/* handler: j.Compression type=archive.Compression kind=int quoted=false*/
  1029  
  1030  	{
  1031  		if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
  1032  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for Compression", tok))
  1033  		}
  1034  	}
  1035  
  1036  	{
  1037  
  1038  		if tok == fflib.FFTok_null {
  1039  
  1040  		} else {
  1041  
  1042  			tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
  1043  
  1044  			if err != nil {
  1045  				return fs.WrapErr(err)
  1046  			}
  1047  
  1048  			j.Compression = Compression(tval)
  1049  
  1050  		}
  1051  	}
  1052  
  1053  	state = fflib.FFParse_after_value
  1054  	goto mainparse
  1055  
  1056  handle_NoLchown:
  1057  
  1058  	/* handler: j.NoLchown type=bool kind=bool quoted=false*/
  1059  
  1060  	{
  1061  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  1062  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  1063  		}
  1064  	}
  1065  
  1066  	{
  1067  		if tok == fflib.FFTok_null {
  1068  
  1069  		} else {
  1070  			tmpb := fs.Output.Bytes()
  1071  
  1072  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  1073  
  1074  				j.NoLchown = true
  1075  
  1076  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  1077  
  1078  				j.NoLchown = false
  1079  
  1080  			} else {
  1081  				err = errors.New("unexpected bytes for true/false value")
  1082  				return fs.WrapErr(err)
  1083  			}
  1084  
  1085  		}
  1086  	}
  1087  
  1088  	state = fflib.FFParse_after_value
  1089  	goto mainparse
  1090  
  1091  handle_UIDMaps:
  1092  
  1093  	/* handler: j.UIDMaps type=[]idtools.IDMap kind=slice quoted=false*/
  1094  
  1095  	{
  1096  
  1097  		{
  1098  			if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
  1099  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
  1100  			}
  1101  		}
  1102  
  1103  		if tok == fflib.FFTok_null {
  1104  			j.UIDMaps = nil
  1105  		} else {
  1106  
  1107  			j.UIDMaps = []idtools.IDMap{}
  1108  
  1109  			wantVal := true
  1110  
  1111  			for {
  1112  
  1113  				var tmpJUIDMaps idtools.IDMap
  1114  
  1115  				tok = fs.Scan()
  1116  				if tok == fflib.FFTok_error {
  1117  					goto tokerror
  1118  				}
  1119  				if tok == fflib.FFTok_right_brace {
  1120  					break
  1121  				}
  1122  
  1123  				if tok == fflib.FFTok_comma {
  1124  					if wantVal == true {
  1125  						// TODO(pquerna): this isn't an ideal error message, this handles
  1126  						// things like [,,,] as an array value.
  1127  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  1128  					}
  1129  					continue
  1130  				} else {
  1131  					wantVal = true
  1132  				}
  1133  
  1134  				/* handler: tmpJUIDMaps type=idtools.IDMap kind=struct quoted=false*/
  1135  
  1136  				{
  1137  					/* Falling back. type=idtools.IDMap kind=struct */
  1138  					tbuf, err := fs.CaptureField(tok)
  1139  					if err != nil {
  1140  						return fs.WrapErr(err)
  1141  					}
  1142  
  1143  					err = json.Unmarshal(tbuf, &tmpJUIDMaps)
  1144  					if err != nil {
  1145  						return fs.WrapErr(err)
  1146  					}
  1147  				}
  1148  
  1149  				j.UIDMaps = append(j.UIDMaps, tmpJUIDMaps)
  1150  
  1151  				wantVal = false
  1152  			}
  1153  		}
  1154  	}
  1155  
  1156  	state = fflib.FFParse_after_value
  1157  	goto mainparse
  1158  
  1159  handle_GIDMaps:
  1160  
  1161  	/* handler: j.GIDMaps type=[]idtools.IDMap kind=slice quoted=false*/
  1162  
  1163  	{
  1164  
  1165  		{
  1166  			if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {
  1167  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
  1168  			}
  1169  		}
  1170  
  1171  		if tok == fflib.FFTok_null {
  1172  			j.GIDMaps = nil
  1173  		} else {
  1174  
  1175  			j.GIDMaps = []idtools.IDMap{}
  1176  
  1177  			wantVal := true
  1178  
  1179  			for {
  1180  
  1181  				var tmpJGIDMaps idtools.IDMap
  1182  
  1183  				tok = fs.Scan()
  1184  				if tok == fflib.FFTok_error {
  1185  					goto tokerror
  1186  				}
  1187  				if tok == fflib.FFTok_right_brace {
  1188  					break
  1189  				}
  1190  
  1191  				if tok == fflib.FFTok_comma {
  1192  					if wantVal == true {
  1193  						// TODO(pquerna): this isn't an ideal error message, this handles
  1194  						// things like [,,,] as an array value.
  1195  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  1196  					}
  1197  					continue
  1198  				} else {
  1199  					wantVal = true
  1200  				}
  1201  
  1202  				/* handler: tmpJGIDMaps type=idtools.IDMap kind=struct quoted=false*/
  1203  
  1204  				{
  1205  					/* Falling back. type=idtools.IDMap kind=struct */
  1206  					tbuf, err := fs.CaptureField(tok)
  1207  					if err != nil {
  1208  						return fs.WrapErr(err)
  1209  					}
  1210  
  1211  					err = json.Unmarshal(tbuf, &tmpJGIDMaps)
  1212  					if err != nil {
  1213  						return fs.WrapErr(err)
  1214  					}
  1215  				}
  1216  
  1217  				j.GIDMaps = append(j.GIDMaps, tmpJGIDMaps)
  1218  
  1219  				wantVal = false
  1220  			}
  1221  		}
  1222  	}
  1223  
  1224  	state = fflib.FFParse_after_value
  1225  	goto mainparse
  1226  
  1227  handle_ChownOpts:
  1228  
  1229  	/* handler: j.ChownOpts type=idtools.IDPair kind=struct quoted=false*/
  1230  
  1231  	{
  1232  		/* Falling back. type=idtools.IDPair kind=struct */
  1233  		tbuf, err := fs.CaptureField(tok)
  1234  		if err != nil {
  1235  			return fs.WrapErr(err)
  1236  		}
  1237  
  1238  		err = json.Unmarshal(tbuf, &j.ChownOpts)
  1239  		if err != nil {
  1240  			return fs.WrapErr(err)
  1241  		}
  1242  	}
  1243  
  1244  	state = fflib.FFParse_after_value
  1245  	goto mainparse
  1246  
  1247  handle_IncludeSourceDir:
  1248  
  1249  	/* handler: j.IncludeSourceDir type=bool kind=bool quoted=false*/
  1250  
  1251  	{
  1252  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  1253  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  1254  		}
  1255  	}
  1256  
  1257  	{
  1258  		if tok == fflib.FFTok_null {
  1259  
  1260  		} else {
  1261  			tmpb := fs.Output.Bytes()
  1262  
  1263  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  1264  
  1265  				j.IncludeSourceDir = true
  1266  
  1267  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  1268  
  1269  				j.IncludeSourceDir = false
  1270  
  1271  			} else {
  1272  				err = errors.New("unexpected bytes for true/false value")
  1273  				return fs.WrapErr(err)
  1274  			}
  1275  
  1276  		}
  1277  	}
  1278  
  1279  	state = fflib.FFParse_after_value
  1280  	goto mainparse
  1281  
  1282  handle_WhiteoutFormat:
  1283  
  1284  	/* handler: j.WhiteoutFormat type=archive.WhiteoutFormat kind=int quoted=false*/
  1285  
  1286  	{
  1287  		if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
  1288  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for WhiteoutFormat", tok))
  1289  		}
  1290  	}
  1291  
  1292  	{
  1293  
  1294  		if tok == fflib.FFTok_null {
  1295  
  1296  		} else {
  1297  
  1298  			tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
  1299  
  1300  			if err != nil {
  1301  				return fs.WrapErr(err)
  1302  			}
  1303  
  1304  			j.WhiteoutFormat = WhiteoutFormat(tval)
  1305  
  1306  		}
  1307  	}
  1308  
  1309  	state = fflib.FFParse_after_value
  1310  	goto mainparse
  1311  
  1312  handle_WhiteoutData:
  1313  
  1314  	/* handler: j.WhiteoutData type=interface {} kind=interface quoted=false*/
  1315  
  1316  	{
  1317  		/* Falling back. type=interface {} kind=interface */
  1318  		tbuf, err := fs.CaptureField(tok)
  1319  		if err != nil {
  1320  			return fs.WrapErr(err)
  1321  		}
  1322  
  1323  		err = json.Unmarshal(tbuf, &j.WhiteoutData)
  1324  		if err != nil {
  1325  			return fs.WrapErr(err)
  1326  		}
  1327  	}
  1328  
  1329  	state = fflib.FFParse_after_value
  1330  	goto mainparse
  1331  
  1332  handle_NoOverwriteDirNonDir:
  1333  
  1334  	/* handler: j.NoOverwriteDirNonDir type=bool kind=bool quoted=false*/
  1335  
  1336  	{
  1337  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  1338  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  1339  		}
  1340  	}
  1341  
  1342  	{
  1343  		if tok == fflib.FFTok_null {
  1344  
  1345  		} else {
  1346  			tmpb := fs.Output.Bytes()
  1347  
  1348  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  1349  
  1350  				j.NoOverwriteDirNonDir = true
  1351  
  1352  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  1353  
  1354  				j.NoOverwriteDirNonDir = false
  1355  
  1356  			} else {
  1357  				err = errors.New("unexpected bytes for true/false value")
  1358  				return fs.WrapErr(err)
  1359  			}
  1360  
  1361  		}
  1362  	}
  1363  
  1364  	state = fflib.FFParse_after_value
  1365  	goto mainparse
  1366  
  1367  handle_RebaseNames:
  1368  
  1369  	/* handler: j.RebaseNames type=map[string]string kind=map quoted=false*/
  1370  
  1371  	{
  1372  
  1373  		{
  1374  			if tok != fflib.FFTok_left_bracket && tok != fflib.FFTok_null {
  1375  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
  1376  			}
  1377  		}
  1378  
  1379  		if tok == fflib.FFTok_null {
  1380  			j.RebaseNames = nil
  1381  		} else {
  1382  
  1383  			j.RebaseNames = make(map[string]string, 0)
  1384  
  1385  			wantVal := true
  1386  
  1387  			for {
  1388  
  1389  				var k string
  1390  
  1391  				var tmpJRebaseNames string
  1392  
  1393  				tok = fs.Scan()
  1394  				if tok == fflib.FFTok_error {
  1395  					goto tokerror
  1396  				}
  1397  				if tok == fflib.FFTok_right_bracket {
  1398  					break
  1399  				}
  1400  
  1401  				if tok == fflib.FFTok_comma {
  1402  					if wantVal == true {
  1403  						// TODO(pquerna): this isn't an ideal error message, this handles
  1404  						// things like [,,,] as an array value.
  1405  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  1406  					}
  1407  					continue
  1408  				} else {
  1409  					wantVal = true
  1410  				}
  1411  
  1412  				/* handler: k type=string kind=string quoted=false*/
  1413  
  1414  				{
  1415  
  1416  					{
  1417  						if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
  1418  							return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
  1419  						}
  1420  					}
  1421  
  1422  					if tok == fflib.FFTok_null {
  1423  
  1424  					} else {
  1425  
  1426  						outBuf := fs.Output.Bytes()
  1427  
  1428  						k = string(string(outBuf))
  1429  
  1430  					}
  1431  				}
  1432  
  1433  				// Expect ':' after key
  1434  				tok = fs.Scan()
  1435  				if tok != fflib.FFTok_colon {
  1436  					return fs.WrapErr(fmt.Errorf("wanted colon token, but got token: %v", tok))
  1437  				}
  1438  
  1439  				tok = fs.Scan()
  1440  				/* handler: tmpJRebaseNames type=string kind=string quoted=false*/
  1441  
  1442  				{
  1443  
  1444  					{
  1445  						if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
  1446  							return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
  1447  						}
  1448  					}
  1449  
  1450  					if tok == fflib.FFTok_null {
  1451  
  1452  					} else {
  1453  
  1454  						outBuf := fs.Output.Bytes()
  1455  
  1456  						tmpJRebaseNames = string(string(outBuf))
  1457  
  1458  					}
  1459  				}
  1460  
  1461  				j.RebaseNames[k] = tmpJRebaseNames
  1462  
  1463  				wantVal = false
  1464  			}
  1465  
  1466  		}
  1467  	}
  1468  
  1469  	state = fflib.FFParse_after_value
  1470  	goto mainparse
  1471  
  1472  handle_InUserNS:
  1473  
  1474  	/* handler: j.InUserNS type=bool kind=bool quoted=false*/
  1475  
  1476  	{
  1477  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  1478  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  1479  		}
  1480  	}
  1481  
  1482  	{
  1483  		if tok == fflib.FFTok_null {
  1484  
  1485  		} else {
  1486  			tmpb := fs.Output.Bytes()
  1487  
  1488  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  1489  
  1490  				j.InUserNS = true
  1491  
  1492  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  1493  
  1494  				j.InUserNS = false
  1495  
  1496  			} else {
  1497  				err = errors.New("unexpected bytes for true/false value")
  1498  				return fs.WrapErr(err)
  1499  			}
  1500  
  1501  		}
  1502  	}
  1503  
  1504  	state = fflib.FFParse_after_value
  1505  	goto mainparse
  1506  
  1507  handle_CopyPass:
  1508  
  1509  	/* handler: j.CopyPass type=bool kind=bool quoted=false*/
  1510  
  1511  	{
  1512  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  1513  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  1514  		}
  1515  	}
  1516  
  1517  	{
  1518  		if tok == fflib.FFTok_null {
  1519  
  1520  		} else {
  1521  			tmpb := fs.Output.Bytes()
  1522  
  1523  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  1524  
  1525  				j.CopyPass = true
  1526  
  1527  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  1528  
  1529  				j.CopyPass = false
  1530  
  1531  			} else {
  1532  				err = errors.New("unexpected bytes for true/false value")
  1533  				return fs.WrapErr(err)
  1534  			}
  1535  
  1536  		}
  1537  	}
  1538  
  1539  	state = fflib.FFParse_after_value
  1540  	goto mainparse
  1541  
  1542  wantedvalue:
  1543  	return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  1544  wrongtokenerror:
  1545  	return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
  1546  tokerror:
  1547  	if fs.BigError != nil {
  1548  		return fs.WrapErr(fs.BigError)
  1549  	}
  1550  	err = fs.Error.ToError()
  1551  	if err != nil {
  1552  		return fs.WrapErr(err)
  1553  	}
  1554  	panic("ffjson-generated: unreachable, please report bug.")
  1555  done:
  1556  
  1557  	return nil
  1558  }
  1559  
  1560  // MarshalJSON marshal bytes to json - template
  1561  func (j *TempArchive) MarshalJSON() ([]byte, error) {
  1562  	var buf fflib.Buffer
  1563  	if j == nil {
  1564  		buf.WriteString("null")
  1565  		return buf.Bytes(), nil
  1566  	}
  1567  	err := j.MarshalJSONBuf(&buf)
  1568  	if err != nil {
  1569  		return nil, err
  1570  	}
  1571  	return buf.Bytes(), nil
  1572  }
  1573  
  1574  // MarshalJSONBuf marshal buff to json - template
  1575  func (j *TempArchive) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
  1576  	if j == nil {
  1577  		buf.WriteString("null")
  1578  		return nil
  1579  	}
  1580  	var err error
  1581  	var obj []byte
  1582  	_ = obj
  1583  	_ = err
  1584  	buf.WriteString(`{"Size":`)
  1585  	fflib.FormatBits2(buf, uint64(j.Size), 10, j.Size < 0)
  1586  	buf.WriteByte('}')
  1587  	return nil
  1588  }
  1589  
  1590  const (
  1591  	ffjtTempArchivebase = iota
  1592  	ffjtTempArchivenosuchkey
  1593  
  1594  	ffjtTempArchiveSize
  1595  )
  1596  
  1597  var ffjKeyTempArchiveSize = []byte("Size")
  1598  
  1599  // UnmarshalJSON umarshall json - template of ffjson
  1600  func (j *TempArchive) UnmarshalJSON(input []byte) error {
  1601  	fs := fflib.NewFFLexer(input)
  1602  	return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
  1603  }
  1604  
  1605  // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
  1606  func (j *TempArchive) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
  1607  	var err error
  1608  	currentKey := ffjtTempArchivebase
  1609  	_ = currentKey
  1610  	tok := fflib.FFTok_init
  1611  	wantedTok := fflib.FFTok_init
  1612  
  1613  mainparse:
  1614  	for {
  1615  		tok = fs.Scan()
  1616  		//	println(fmt.Sprintf("debug: tok: %v  state: %v", tok, state))
  1617  		if tok == fflib.FFTok_error {
  1618  			goto tokerror
  1619  		}
  1620  
  1621  		switch state {
  1622  
  1623  		case fflib.FFParse_map_start:
  1624  			if tok != fflib.FFTok_left_bracket {
  1625  				wantedTok = fflib.FFTok_left_bracket
  1626  				goto wrongtokenerror
  1627  			}
  1628  			state = fflib.FFParse_want_key
  1629  			continue
  1630  
  1631  		case fflib.FFParse_after_value:
  1632  			if tok == fflib.FFTok_comma {
  1633  				state = fflib.FFParse_want_key
  1634  			} else if tok == fflib.FFTok_right_bracket {
  1635  				goto done
  1636  			} else {
  1637  				wantedTok = fflib.FFTok_comma
  1638  				goto wrongtokenerror
  1639  			}
  1640  
  1641  		case fflib.FFParse_want_key:
  1642  			// json {} ended. goto exit. woo.
  1643  			if tok == fflib.FFTok_right_bracket {
  1644  				goto done
  1645  			}
  1646  			if tok != fflib.FFTok_string {
  1647  				wantedTok = fflib.FFTok_string
  1648  				goto wrongtokenerror
  1649  			}
  1650  
  1651  			kn := fs.Output.Bytes()
  1652  			if len(kn) <= 0 {
  1653  				// "" case. hrm.
  1654  				currentKey = ffjtTempArchivenosuchkey
  1655  				state = fflib.FFParse_want_colon
  1656  				goto mainparse
  1657  			} else {
  1658  				switch kn[0] {
  1659  
  1660  				case 'S':
  1661  
  1662  					if bytes.Equal(ffjKeyTempArchiveSize, kn) {
  1663  						currentKey = ffjtTempArchiveSize
  1664  						state = fflib.FFParse_want_colon
  1665  						goto mainparse
  1666  					}
  1667  
  1668  				}
  1669  
  1670  				if fflib.EqualFoldRight(ffjKeyTempArchiveSize, kn) {
  1671  					currentKey = ffjtTempArchiveSize
  1672  					state = fflib.FFParse_want_colon
  1673  					goto mainparse
  1674  				}
  1675  
  1676  				currentKey = ffjtTempArchivenosuchkey
  1677  				state = fflib.FFParse_want_colon
  1678  				goto mainparse
  1679  			}
  1680  
  1681  		case fflib.FFParse_want_colon:
  1682  			if tok != fflib.FFTok_colon {
  1683  				wantedTok = fflib.FFTok_colon
  1684  				goto wrongtokenerror
  1685  			}
  1686  			state = fflib.FFParse_want_value
  1687  			continue
  1688  		case fflib.FFParse_want_value:
  1689  
  1690  			if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
  1691  				switch currentKey {
  1692  
  1693  				case ffjtTempArchiveSize:
  1694  					goto handle_Size
  1695  
  1696  				case ffjtTempArchivenosuchkey:
  1697  					err = fs.SkipField(tok)
  1698  					if err != nil {
  1699  						return fs.WrapErr(err)
  1700  					}
  1701  					state = fflib.FFParse_after_value
  1702  					goto mainparse
  1703  				}
  1704  			} else {
  1705  				goto wantedvalue
  1706  			}
  1707  		}
  1708  	}
  1709  
  1710  handle_Size:
  1711  
  1712  	/* handler: j.Size type=int64 kind=int64 quoted=false*/
  1713  
  1714  	{
  1715  		if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
  1716  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int64", tok))
  1717  		}
  1718  	}
  1719  
  1720  	{
  1721  
  1722  		if tok == fflib.FFTok_null {
  1723  
  1724  		} else {
  1725  
  1726  			tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
  1727  
  1728  			if err != nil {
  1729  				return fs.WrapErr(err)
  1730  			}
  1731  
  1732  			j.Size = int64(tval)
  1733  
  1734  		}
  1735  	}
  1736  
  1737  	state = fflib.FFParse_after_value
  1738  	goto mainparse
  1739  
  1740  wantedvalue:
  1741  	return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  1742  wrongtokenerror:
  1743  	return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
  1744  tokerror:
  1745  	if fs.BigError != nil {
  1746  		return fs.WrapErr(fs.BigError)
  1747  	}
  1748  	err = fs.Error.ToError()
  1749  	if err != nil {
  1750  		return fs.WrapErr(err)
  1751  	}
  1752  	panic("ffjson-generated: unreachable, please report bug.")
  1753  done:
  1754  
  1755  	return nil
  1756  }
  1757  
  1758  // MarshalJSON marshal bytes to json - template
  1759  func (j *tarAppender) MarshalJSON() ([]byte, error) {
  1760  	var buf fflib.Buffer
  1761  	if j == nil {
  1762  		buf.WriteString("null")
  1763  		return buf.Bytes(), nil
  1764  	}
  1765  	err := j.MarshalJSONBuf(&buf)
  1766  	if err != nil {
  1767  		return nil, err
  1768  	}
  1769  	return buf.Bytes(), nil
  1770  }
  1771  
  1772  // MarshalJSONBuf marshal buff to json - template
  1773  func (j *tarAppender) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
  1774  	if j == nil {
  1775  		buf.WriteString("null")
  1776  		return nil
  1777  	}
  1778  	var err error
  1779  	var obj []byte
  1780  	_ = obj
  1781  	_ = err
  1782  	if j.TarWriter != nil {
  1783  		/* Struct fall back. type=tar.Writer kind=struct */
  1784  		buf.WriteString(`{"TarWriter":`)
  1785  		err = buf.Encode(j.TarWriter)
  1786  		if err != nil {
  1787  			return err
  1788  		}
  1789  	} else {
  1790  		buf.WriteString(`{"TarWriter":null`)
  1791  	}
  1792  	if j.Buffer != nil {
  1793  		/* Struct fall back. type=bufio.Writer kind=struct */
  1794  		buf.WriteString(`,"Buffer":`)
  1795  		err = buf.Encode(j.Buffer)
  1796  		if err != nil {
  1797  			return err
  1798  		}
  1799  	} else {
  1800  		buf.WriteString(`,"Buffer":null`)
  1801  	}
  1802  	/* Falling back. type=map[uint64]string kind=map */
  1803  	buf.WriteString(`,"SeenFiles":`)
  1804  	err = buf.Encode(j.SeenFiles)
  1805  	if err != nil {
  1806  		return err
  1807  	}
  1808  	if j.IDMappings != nil {
  1809  		/* Struct fall back. type=idtools.IDMappings kind=struct */
  1810  		buf.WriteString(`,"IDMappings":`)
  1811  		err = buf.Encode(j.IDMappings)
  1812  		if err != nil {
  1813  			return err
  1814  		}
  1815  	} else {
  1816  		buf.WriteString(`,"IDMappings":null`)
  1817  	}
  1818  	if j.ChownOpts != nil {
  1819  		/* Struct fall back. type=idtools.IDPair kind=struct */
  1820  		buf.WriteString(`,"ChownOpts":`)
  1821  		err = buf.Encode(j.ChownOpts)
  1822  		if err != nil {
  1823  			return err
  1824  		}
  1825  	} else {
  1826  		buf.WriteString(`,"ChownOpts":null`)
  1827  	}
  1828  	buf.WriteString(`,"WhiteoutConverter":`)
  1829  	/* Interface types must use runtime reflection. type=archive.tarWhiteoutConverter kind=interface */
  1830  	err = buf.Encode(j.WhiteoutConverter)
  1831  	if err != nil {
  1832  		return err
  1833  	}
  1834  	if j.CopyPass {
  1835  		buf.WriteString(`,"CopyPass":true`)
  1836  	} else {
  1837  		buf.WriteString(`,"CopyPass":false`)
  1838  	}
  1839  	buf.WriteByte('}')
  1840  	return nil
  1841  }
  1842  
  1843  const (
  1844  	ffjttarAppenderbase = iota
  1845  	ffjttarAppendernosuchkey
  1846  
  1847  	ffjttarAppenderTarWriter
  1848  
  1849  	ffjttarAppenderBuffer
  1850  
  1851  	ffjttarAppenderSeenFiles
  1852  
  1853  	ffjttarAppenderIDMappings
  1854  
  1855  	ffjttarAppenderChownOpts
  1856  
  1857  	ffjttarAppenderWhiteoutConverter
  1858  
  1859  	ffjttarAppenderCopyPass
  1860  )
  1861  
  1862  var ffjKeytarAppenderTarWriter = []byte("TarWriter")
  1863  
  1864  var ffjKeytarAppenderBuffer = []byte("Buffer")
  1865  
  1866  var ffjKeytarAppenderSeenFiles = []byte("SeenFiles")
  1867  
  1868  var ffjKeytarAppenderIDMappings = []byte("IDMappings")
  1869  
  1870  var ffjKeytarAppenderChownOpts = []byte("ChownOpts")
  1871  
  1872  var ffjKeytarAppenderWhiteoutConverter = []byte("WhiteoutConverter")
  1873  
  1874  var ffjKeytarAppenderCopyPass = []byte("CopyPass")
  1875  
  1876  // UnmarshalJSON umarshall json - template of ffjson
  1877  func (j *tarAppender) UnmarshalJSON(input []byte) error {
  1878  	fs := fflib.NewFFLexer(input)
  1879  	return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
  1880  }
  1881  
  1882  // UnmarshalJSONFFLexer fast json unmarshall - template ffjson
  1883  func (j *tarAppender) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
  1884  	var err error
  1885  	currentKey := ffjttarAppenderbase
  1886  	_ = currentKey
  1887  	tok := fflib.FFTok_init
  1888  	wantedTok := fflib.FFTok_init
  1889  
  1890  mainparse:
  1891  	for {
  1892  		tok = fs.Scan()
  1893  		//	println(fmt.Sprintf("debug: tok: %v  state: %v", tok, state))
  1894  		if tok == fflib.FFTok_error {
  1895  			goto tokerror
  1896  		}
  1897  
  1898  		switch state {
  1899  
  1900  		case fflib.FFParse_map_start:
  1901  			if tok != fflib.FFTok_left_bracket {
  1902  				wantedTok = fflib.FFTok_left_bracket
  1903  				goto wrongtokenerror
  1904  			}
  1905  			state = fflib.FFParse_want_key
  1906  			continue
  1907  
  1908  		case fflib.FFParse_after_value:
  1909  			if tok == fflib.FFTok_comma {
  1910  				state = fflib.FFParse_want_key
  1911  			} else if tok == fflib.FFTok_right_bracket {
  1912  				goto done
  1913  			} else {
  1914  				wantedTok = fflib.FFTok_comma
  1915  				goto wrongtokenerror
  1916  			}
  1917  
  1918  		case fflib.FFParse_want_key:
  1919  			// json {} ended. goto exit. woo.
  1920  			if tok == fflib.FFTok_right_bracket {
  1921  				goto done
  1922  			}
  1923  			if tok != fflib.FFTok_string {
  1924  				wantedTok = fflib.FFTok_string
  1925  				goto wrongtokenerror
  1926  			}
  1927  
  1928  			kn := fs.Output.Bytes()
  1929  			if len(kn) <= 0 {
  1930  				// "" case. hrm.
  1931  				currentKey = ffjttarAppendernosuchkey
  1932  				state = fflib.FFParse_want_colon
  1933  				goto mainparse
  1934  			} else {
  1935  				switch kn[0] {
  1936  
  1937  				case 'B':
  1938  
  1939  					if bytes.Equal(ffjKeytarAppenderBuffer, kn) {
  1940  						currentKey = ffjttarAppenderBuffer
  1941  						state = fflib.FFParse_want_colon
  1942  						goto mainparse
  1943  					}
  1944  
  1945  				case 'C':
  1946  
  1947  					if bytes.Equal(ffjKeytarAppenderChownOpts, kn) {
  1948  						currentKey = ffjttarAppenderChownOpts
  1949  						state = fflib.FFParse_want_colon
  1950  						goto mainparse
  1951  
  1952  					} else if bytes.Equal(ffjKeytarAppenderCopyPass, kn) {
  1953  						currentKey = ffjttarAppenderCopyPass
  1954  						state = fflib.FFParse_want_colon
  1955  						goto mainparse
  1956  					}
  1957  
  1958  				case 'I':
  1959  
  1960  					if bytes.Equal(ffjKeytarAppenderIDMappings, kn) {
  1961  						currentKey = ffjttarAppenderIDMappings
  1962  						state = fflib.FFParse_want_colon
  1963  						goto mainparse
  1964  					}
  1965  
  1966  				case 'S':
  1967  
  1968  					if bytes.Equal(ffjKeytarAppenderSeenFiles, kn) {
  1969  						currentKey = ffjttarAppenderSeenFiles
  1970  						state = fflib.FFParse_want_colon
  1971  						goto mainparse
  1972  					}
  1973  
  1974  				case 'T':
  1975  
  1976  					if bytes.Equal(ffjKeytarAppenderTarWriter, kn) {
  1977  						currentKey = ffjttarAppenderTarWriter
  1978  						state = fflib.FFParse_want_colon
  1979  						goto mainparse
  1980  					}
  1981  
  1982  				case 'W':
  1983  
  1984  					if bytes.Equal(ffjKeytarAppenderWhiteoutConverter, kn) {
  1985  						currentKey = ffjttarAppenderWhiteoutConverter
  1986  						state = fflib.FFParse_want_colon
  1987  						goto mainparse
  1988  					}
  1989  
  1990  				}
  1991  
  1992  				if fflib.EqualFoldRight(ffjKeytarAppenderCopyPass, kn) {
  1993  					currentKey = ffjttarAppenderCopyPass
  1994  					state = fflib.FFParse_want_colon
  1995  					goto mainparse
  1996  				}
  1997  
  1998  				if fflib.SimpleLetterEqualFold(ffjKeytarAppenderWhiteoutConverter, kn) {
  1999  					currentKey = ffjttarAppenderWhiteoutConverter
  2000  					state = fflib.FFParse_want_colon
  2001  					goto mainparse
  2002  				}
  2003  
  2004  				if fflib.EqualFoldRight(ffjKeytarAppenderChownOpts, kn) {
  2005  					currentKey = ffjttarAppenderChownOpts
  2006  					state = fflib.FFParse_want_colon
  2007  					goto mainparse
  2008  				}
  2009  
  2010  				if fflib.EqualFoldRight(ffjKeytarAppenderIDMappings, kn) {
  2011  					currentKey = ffjttarAppenderIDMappings
  2012  					state = fflib.FFParse_want_colon
  2013  					goto mainparse
  2014  				}
  2015  
  2016  				if fflib.EqualFoldRight(ffjKeytarAppenderSeenFiles, kn) {
  2017  					currentKey = ffjttarAppenderSeenFiles
  2018  					state = fflib.FFParse_want_colon
  2019  					goto mainparse
  2020  				}
  2021  
  2022  				if fflib.SimpleLetterEqualFold(ffjKeytarAppenderBuffer, kn) {
  2023  					currentKey = ffjttarAppenderBuffer
  2024  					state = fflib.FFParse_want_colon
  2025  					goto mainparse
  2026  				}
  2027  
  2028  				if fflib.SimpleLetterEqualFold(ffjKeytarAppenderTarWriter, kn) {
  2029  					currentKey = ffjttarAppenderTarWriter
  2030  					state = fflib.FFParse_want_colon
  2031  					goto mainparse
  2032  				}
  2033  
  2034  				currentKey = ffjttarAppendernosuchkey
  2035  				state = fflib.FFParse_want_colon
  2036  				goto mainparse
  2037  			}
  2038  
  2039  		case fflib.FFParse_want_colon:
  2040  			if tok != fflib.FFTok_colon {
  2041  				wantedTok = fflib.FFTok_colon
  2042  				goto wrongtokenerror
  2043  			}
  2044  			state = fflib.FFParse_want_value
  2045  			continue
  2046  		case fflib.FFParse_want_value:
  2047  
  2048  			if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
  2049  				switch currentKey {
  2050  
  2051  				case ffjttarAppenderTarWriter:
  2052  					goto handle_TarWriter
  2053  
  2054  				case ffjttarAppenderBuffer:
  2055  					goto handle_Buffer
  2056  
  2057  				case ffjttarAppenderSeenFiles:
  2058  					goto handle_SeenFiles
  2059  
  2060  				case ffjttarAppenderIDMappings:
  2061  					goto handle_IDMappings
  2062  
  2063  				case ffjttarAppenderChownOpts:
  2064  					goto handle_ChownOpts
  2065  
  2066  				case ffjttarAppenderWhiteoutConverter:
  2067  					goto handle_WhiteoutConverter
  2068  
  2069  				case ffjttarAppenderCopyPass:
  2070  					goto handle_CopyPass
  2071  
  2072  				case ffjttarAppendernosuchkey:
  2073  					err = fs.SkipField(tok)
  2074  					if err != nil {
  2075  						return fs.WrapErr(err)
  2076  					}
  2077  					state = fflib.FFParse_after_value
  2078  					goto mainparse
  2079  				}
  2080  			} else {
  2081  				goto wantedvalue
  2082  			}
  2083  		}
  2084  	}
  2085  
  2086  handle_TarWriter:
  2087  
  2088  	/* handler: j.TarWriter type=tar.Writer kind=struct quoted=false*/
  2089  
  2090  	{
  2091  		/* Falling back. type=tar.Writer kind=struct */
  2092  		tbuf, err := fs.CaptureField(tok)
  2093  		if err != nil {
  2094  			return fs.WrapErr(err)
  2095  		}
  2096  
  2097  		err = json.Unmarshal(tbuf, &j.TarWriter)
  2098  		if err != nil {
  2099  			return fs.WrapErr(err)
  2100  		}
  2101  	}
  2102  
  2103  	state = fflib.FFParse_after_value
  2104  	goto mainparse
  2105  
  2106  handle_Buffer:
  2107  
  2108  	/* handler: j.Buffer type=bufio.Writer kind=struct quoted=false*/
  2109  
  2110  	{
  2111  		/* Falling back. type=bufio.Writer kind=struct */
  2112  		tbuf, err := fs.CaptureField(tok)
  2113  		if err != nil {
  2114  			return fs.WrapErr(err)
  2115  		}
  2116  
  2117  		err = json.Unmarshal(tbuf, &j.Buffer)
  2118  		if err != nil {
  2119  			return fs.WrapErr(err)
  2120  		}
  2121  	}
  2122  
  2123  	state = fflib.FFParse_after_value
  2124  	goto mainparse
  2125  
  2126  handle_SeenFiles:
  2127  
  2128  	/* handler: j.SeenFiles type=map[uint64]string kind=map quoted=false*/
  2129  
  2130  	{
  2131  
  2132  		{
  2133  			if tok != fflib.FFTok_left_bracket && tok != fflib.FFTok_null {
  2134  				return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok))
  2135  			}
  2136  		}
  2137  
  2138  		if tok == fflib.FFTok_null {
  2139  			j.SeenFiles = nil
  2140  		} else {
  2141  
  2142  			j.SeenFiles = make(map[uint64]string, 0)
  2143  
  2144  			wantVal := true
  2145  
  2146  			for {
  2147  
  2148  				var k uint64
  2149  
  2150  				var tmpJSeenFiles string
  2151  
  2152  				tok = fs.Scan()
  2153  				if tok == fflib.FFTok_error {
  2154  					goto tokerror
  2155  				}
  2156  				if tok == fflib.FFTok_right_bracket {
  2157  					break
  2158  				}
  2159  
  2160  				if tok == fflib.FFTok_comma {
  2161  					if wantVal == true {
  2162  						// TODO(pquerna): this isn't an ideal error message, this handles
  2163  						// things like [,,,] as an array value.
  2164  						return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  2165  					}
  2166  					continue
  2167  				} else {
  2168  					wantVal = true
  2169  				}
  2170  
  2171  				/* handler: k type=uint64 kind=uint64 quoted=false*/
  2172  
  2173  				{
  2174  					if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
  2175  						return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for uint64", tok))
  2176  					}
  2177  				}
  2178  
  2179  				{
  2180  
  2181  					if tok == fflib.FFTok_null {
  2182  
  2183  					} else {
  2184  
  2185  						tval, err := fflib.ParseUint(fs.Output.Bytes(), 10, 64)
  2186  
  2187  						if err != nil {
  2188  							return fs.WrapErr(err)
  2189  						}
  2190  
  2191  						k = uint64(tval)
  2192  
  2193  					}
  2194  				}
  2195  
  2196  				// Expect ':' after key
  2197  				tok = fs.Scan()
  2198  				if tok != fflib.FFTok_colon {
  2199  					return fs.WrapErr(fmt.Errorf("wanted colon token, but got token: %v", tok))
  2200  				}
  2201  
  2202  				tok = fs.Scan()
  2203  				/* handler: tmpJSeenFiles type=string kind=string quoted=false*/
  2204  
  2205  				{
  2206  
  2207  					{
  2208  						if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
  2209  							return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
  2210  						}
  2211  					}
  2212  
  2213  					if tok == fflib.FFTok_null {
  2214  
  2215  					} else {
  2216  
  2217  						outBuf := fs.Output.Bytes()
  2218  
  2219  						tmpJSeenFiles = string(string(outBuf))
  2220  
  2221  					}
  2222  				}
  2223  
  2224  				j.SeenFiles[k] = tmpJSeenFiles
  2225  
  2226  				wantVal = false
  2227  			}
  2228  
  2229  		}
  2230  	}
  2231  
  2232  	state = fflib.FFParse_after_value
  2233  	goto mainparse
  2234  
  2235  handle_IDMappings:
  2236  
  2237  	/* handler: j.IDMappings type=idtools.IDMappings kind=struct quoted=false*/
  2238  
  2239  	{
  2240  		/* Falling back. type=idtools.IDMappings kind=struct */
  2241  		tbuf, err := fs.CaptureField(tok)
  2242  		if err != nil {
  2243  			return fs.WrapErr(err)
  2244  		}
  2245  
  2246  		err = json.Unmarshal(tbuf, &j.IDMappings)
  2247  		if err != nil {
  2248  			return fs.WrapErr(err)
  2249  		}
  2250  	}
  2251  
  2252  	state = fflib.FFParse_after_value
  2253  	goto mainparse
  2254  
  2255  handle_ChownOpts:
  2256  
  2257  	/* handler: j.ChownOpts type=idtools.IDPair kind=struct quoted=false*/
  2258  
  2259  	{
  2260  		/* Falling back. type=idtools.IDPair kind=struct */
  2261  		tbuf, err := fs.CaptureField(tok)
  2262  		if err != nil {
  2263  			return fs.WrapErr(err)
  2264  		}
  2265  
  2266  		err = json.Unmarshal(tbuf, &j.ChownOpts)
  2267  		if err != nil {
  2268  			return fs.WrapErr(err)
  2269  		}
  2270  	}
  2271  
  2272  	state = fflib.FFParse_after_value
  2273  	goto mainparse
  2274  
  2275  handle_WhiteoutConverter:
  2276  
  2277  	/* handler: j.WhiteoutConverter type=archive.tarWhiteoutConverter kind=interface quoted=false*/
  2278  
  2279  	{
  2280  		/* Falling back. type=archive.tarWhiteoutConverter kind=interface */
  2281  		tbuf, err := fs.CaptureField(tok)
  2282  		if err != nil {
  2283  			return fs.WrapErr(err)
  2284  		}
  2285  
  2286  		err = json.Unmarshal(tbuf, &j.WhiteoutConverter)
  2287  		if err != nil {
  2288  			return fs.WrapErr(err)
  2289  		}
  2290  	}
  2291  
  2292  	state = fflib.FFParse_after_value
  2293  	goto mainparse
  2294  
  2295  handle_CopyPass:
  2296  
  2297  	/* handler: j.CopyPass type=bool kind=bool quoted=false*/
  2298  
  2299  	{
  2300  		if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
  2301  			return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
  2302  		}
  2303  	}
  2304  
  2305  	{
  2306  		if tok == fflib.FFTok_null {
  2307  
  2308  		} else {
  2309  			tmpb := fs.Output.Bytes()
  2310  
  2311  			if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
  2312  
  2313  				j.CopyPass = true
  2314  
  2315  			} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
  2316  
  2317  				j.CopyPass = false
  2318  
  2319  			} else {
  2320  				err = errors.New("unexpected bytes for true/false value")
  2321  				return fs.WrapErr(err)
  2322  			}
  2323  
  2324  		}
  2325  	}
  2326  
  2327  	state = fflib.FFParse_after_value
  2328  	goto mainparse
  2329  
  2330  wantedvalue:
  2331  	return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
  2332  wrongtokenerror:
  2333  	return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
  2334  tokerror:
  2335  	if fs.BigError != nil {
  2336  		return fs.WrapErr(fs.BigError)
  2337  	}
  2338  	err = fs.Error.ToError()
  2339  	if err != nil {
  2340  		return fs.WrapErr(err)
  2341  	}
  2342  	panic("ffjson-generated: unreachable, please report bug.")
  2343  done:
  2344  
  2345  	return nil
  2346  }